- Home /
Light shining through mesh
Hi there. I'm having a little lighting trouble. I have a dynamic mesh that is made up of blocks procedurally. In the screenshot below, I am in a cave. Looking down the cave, you can see the directional lighting shining through. That place is closed off to light, so this shouldn't be happening (likely culling going on).
So moving down to the end, the light disappears and these artifacts show up in its place in the screen below. Messing with the shadow settings, it seems like light is reaching it somehow.
Here is a zoom out of the scene's mesh. The red circle is currently what the player is looking at. I am viewing this from the east perspective of the camera facing. As you can also see, all the "caves" in the distance, undergo this lighting, too, due to culling most likely. What is a way to fix these problems in general? A way so that culling does not ruin the shadows of closed off mesh spaces and cause the problems above?
Yeah. Lightmapping would have fixed it, but the mesh is never deter$$anonymous$$ed beforehand.
Answer by t13d · Jan 16, 2021 at 05:43 PM
I had the exact same problem the first time I attempted voxel terrain. The issue is light isn't being blocked by some tris, so at certain angles sunlight will go through the mesh.
The way to fix this is to add another tri with revered normals for every existing tri.
I would recommend to make these tris connect to different vertexes at the same position as not doing so will cause vertex normals to act weird.,I think it may be that the mesh has only one sided polygons. Maybe try adding 2 triangles with opposite facing normals instead of just one so that light gets blocked by the other side