I am trying to make a sunrise/sunset effect, but the directional light penetrates the model from the backside. So I need your helps to deal with it.
My system is Fedora 32, master Panda3D, master Simplepbr, master blend2bam, Blender 2.8. Everything else works very well. The model (terrain) you see on this picture is just one single static mesh, with a very basic material and a very basic texture, nothing more. The shadow effect of simplepbr is on, and it works very well. The shadow caster is the directional light (the sun), it works very well because I set up the frustum and the shadow mapping size very carefully.
The only problem is that, when the sun going below the horizon, it slightly penetrates from the backside of the terrain model, as you can see in the picture. I have tried something but most of them doesn’t help to fix the issue:
Solidify the terrain model – Doesn’t help.
Made a plane under the terrain to block the sun – Doesn’t help.
terrain.set_two_sides(True) – Doesn’t help
sun.set_color(0) after sunset – It helps a little, but I don’t like this way, because it also disables the beautiful sunset twilight effect when the sun just slightly below the horizon. And also, sometime if my character (camera) stands beside a high mountain, the directional light penetrates the mountain too, even if the directional light’s angle is 30 degrees from the horizon like 10 o’clock in the morning. I certainly do not want to sun.set_color(0) at daytime.
I added a picture here to show that even if the directional light (sun) is above the horizon, it sometime still penetrates the mountain terrain.
So any helps or advices are deeply appreciated!