[Solved] GI like lighting in procedural world

So I have this procedural world that is generated at runtime and I’m not pleased with how the lighting handles the resulting mesh…

[Solved] 1. First issue is that I would like to have Global Illumination in the world but since it’s a procedural world the possibility for that is out the window. So I’m stuck with pitch dark shadows in places where no light shines, is there any solution to this?? (Note that raising the ambient light just makes the now black area a bit brighter, leaving out the details of the mesh)


EDIT: I fixed this by changing my shader a bit.

[Solved] 2. Second issue is the directional light used as a sun doesn’t know where not to shine it’s light, it doesn’t get blocked by terrain above a cave but instead lights up the floor inside the cave. Why does it do this and is there any fix for it?? (Note2 I’m using my own shader for the terrain in forward rendering mode but I doubt that is the problem)
I have tested with disabling backface culling in the shader but that doesn’t help at all…

Soo, to make the solution clear to my problems I simply had to modify my shader a bit to

  1. Handle ambient lighting correctly ( The ambient wasn’t adding the color of the fragment but the ambient color only.)
  2. Support shadows ( Added built in AutoLight.cginc functions to shader for shadows )