Godot Version
4
Question
Hi,
I am still a bit new to shaders and I want to implement some shading/lighting/fake AO on a tilemap similar to Rimworld/Prison Architect.
So I basically have outdoor areas, indoor areas, walls and outdoor lights that will affect the shading/lighting on the tilemap (basically the floor or grass/dirt whatever is on the ground).
Outdoor areas are lit by the sun and outdoor lights, also near the walls the floor needs to have a bit of ambient occlusion (darker towards the corners of the floor/wall).
Indoor areas will not have indoor lights, but are basically either dark (no window), lit by the sun (if the room at least has one window) or lit by indoor lights (that are either cool white or warm white). Indoor also some AO near the walls.
So I have a tilemap and the idea was to color-code some data for each tile and send this as a bitmap to the shader. The info I need to colorcode is the ambient light the tile receives and if I need to draw AO shading on the top, the left and the right of the tile.
In the shader I can figure out in which tile I am drawing and which pixel on that tile and then figure the amount of color correction I need to apply.
But where I am a bit stuck is the outdoor lights. I already calculate the average amount of light a tile receives to know how bright I need to color objects/people on that tile. But if I use this to light the tile, this would give me very rough cornered shapes around the light.
I tried to use regular 2d lights, and add occlusion data for the walls, but my map can be rather big and have hundreds of small lamp posts, this method slowed down FPS a lot and I think I hit some limit as some lights stopped working.
I was thinking of somehow passing the coordinates of all the point lights to the same shader and take that into account (so, only if inside an outdoor cell, lighting the pixel according to the distance of the light).
But I am not sure how that usually is done. Also not sure if all my ideas make sense and are the best techniques to tackle this.
Second question, do you think leaving out the complexity of properly rendering indoor lights and windows would help me (shortcutting it to light the whole area the same), or would it not add that much complexity while looking much better.