Back side of a buffergeometry can't receive light

So I’ve created a buffergeometry and applied a doublesided white meshStandardMaterial. Then I added a light to the scene and it seem like the back side of the geometry is not receiving any light even though it is directly exposed to the light source.

image

image

Note:
Helper with white lines is the helper for a SpotLight
Helper with orange lines is a helper for a secondary camera.

Please provide a live code example that can reproduce this behavior.

1 Like

You can check in this JSFiddle that everything you described seems to work properly. BufferGeometry with DoubleSide material lit by SpotLight

Are you sure you didn’t alter the normals in anyway? The normals look flipped, it would explain this behavior.

I think I know what the problem is now. My BufferGeometry was indexed. Since a single instance of every vertex exist and these vertices’ normals only points to a single direction, that’s why the light is only reflected on one side.

Correct me if I’m wrong

Every normal points in the same direction on a plane. That is, orthogonal to the plane facing forward.

What you explained wouldn’t cause this behavior, because the backface normals are inverted on rendering time inside the shader. Make sure it works correctly for FrontSide material and it will work correctly for DoubleSide. JSFiddle

Without any live examples, I’m afraid it won’t be possible to help you more than this.

1 Like

Unfortunately I can’t share the code here. “Can’t” meaning I’m not allowed to.

Although I have new findings

Seems like the normals are normal. If I move the light under the mesh. It does light the mesh.

Light placement 1
image
image

Light placement 2 (Below mesh)
image
image

The weird thing is, if the light is on top, the light only affects the “top” side of the mesh even though it is posed in a way that the “bottom” side should be hit by the light
image
image

Different pose exposing “bottom” side to light
image

@bumblebijan can you create a VertexNormalsHelper using your mesh and share the screenshots?

I added VertexNormalsHelper and it all makes sense now. Seems like the normals are nailed to the object’s original spot. It is shown in this screenshot. Take note that I am calling the helper’s update() function on every render but the normals’ position are not updating on the view. Why is it behaving this way?

image

Just a thought, but is this related to the fact that backside normal’s are inverted?

That tripped me up on something recently (thanks again @sciecode for pointing that out).

I would imagine this is happening because you aren’t recalculating the vertex normals after you modify the vertices along this curved path.

Just a thought, but is this related to the fact that backside normal’s are inverted?

I don’t think so.

I actually tried calling computeVertexNormals() within the looped render method but it didn’t work either.

@bumblebijan can’t you create a simpler version of your code in a live example?

Perhaps just altering a default PlaneBufferGeometry in a similar way that you are updating it in this project. Don’t need to involve the complex curved path you are doing, just something minimal that would replicate your problem.

It’s really hard to debug what’s going on this way, and this is reaching a point where my knowledge falls short.

2 Likes