Godot Version
4.6
Question
I’m building a procedural (voxel) game with in-game editing. I’m using a direct light with shadows for the sun with ambient lighting. in order to influence the ambient light inside caves, etc, I compute a “ambient light map” (texture3d) with the light levels at each voxel, wich I pass to the shader of the “voxel mesh”.
currently, I set the AO in the fragment shader of the voxel mesh to control the amount of ambient light. this works quite well, but I would need to do this for every material. i.e. also for the objects that are not part of the voxel mesh (like NPCs, or model based items). furthermore, it’s not possible to use the texture3d as global shader variable, so I need update all materials that use it.
another problem is, that I cannot reduce the opacity of the shadows (to make them look softer), otherwise the sunlight will also illuminate the caves. using AO_LIGHT_AFFECT is only a partial solution, as it would also affect other direct lights, like the player’s flashlight.
since godot has different global illumination possibilities, is there a way to somehow use the internal structures to apply my computed ambient light map (without writing an extension
)
or maybe other tricks I can use?
thanks.