Hello all. I am playing around with geometry and have noticed that when an object I created rotates and the backside faces the screen(PointLight position) it does not reflect any light and therefore appears to disappear until it rotates back to the front. At least I think that’s what’s happening.
What do I need to add in order to have the backside of the faces reflect light also? Or can I do a 180 flip the each face?
Thanks in advance
Looks like you can’t edit and save a codepen anonymously but the winding order on your backfaces is probably the reverse what you want causing them to be culled when the star is turned around. You can swap the order of the last two indices in the back faces to solve this.
From this:
new THREE.Face3(11, 1, 2),
new THREE.Face3(11, 2, 3),
new THREE.Face3(11, 3, 4),
To this:
new THREE.Face3(11, 2, 1),
new THREE.Face3(11, 3, 2),
new THREE.Face3(11, 4, 3),
but for all faces.
Alternatively you could set the material to render double sided but this usually isn’t preferred.
1 Like
Well that seemed pretty simple. I can’t wrap my head around it though. Why does the order change cause the face to flip around like that? Whether I draw it clockwise or counterclockwise wouldn’t it still face the same way?
“Back” faces are typically culled as a rendering optimization to avoid rasterizing unnecessary pixels. Depending on your geometry or needs you can set a material to render both triangle sides.
You can read more about it here:
1 Like