What kind of visual effects are you aiming for?
Currently, the code is utilizing MeshBasicMaterial
. According to the documentation, this material is used for rendering geometries in a simplistic shaded manner (flat or wireframe).
MeshBasicMaterial
A material for drawing geometries in a simple shaded (flat or wireframe) way.
I suggest taking a look at this particular example to explore the various materials available and how they will appear in your project.
For instance, this fiddle compares the outcomes of using a MeshBasicMaterial
versus a MeshLambertMaterial
.
Hopefully, this information proves useful.
UPDATE
It seems that your mesh creation process lacks the generation of normals. To achieve desired shading effects with a MeshLambertMaterial, the calculation of normals is crucial in determining light variations:
- The reflection relies on the dot product of the surface's normal vector, N, and a normalized light-direction vector, L, pointing from the surface towards the light source (wikipedia)).
You can utilize the geometry.computeFaceNormals();
function to assist in this process.
Feel free to check out this fiddle for further insight.
In addition, consider exploring JS array objects along with implementing for loops for enhanced functionality.
Hope this guidance serves you well.