I’m a new Godot user and I’m having trouble understanding and using lightmaps, I have read the documentation, but I still need some help
context: I have a 3d scene which uses the mobile renderer, it includes a WorldEnvironment with a sky shader and a static directional sunlight
from what I understand, the lightmap system creates a texture that is applied to all the meshes (which I have already unwrapped) in the scene, capturing shadows and lighting around them, is that correct? please let me know if I misunderstood
I want to bake the lighting from the sky and the sun (these are the only light sources in the scene), but when I bake the lightmap, the result looks very different from what I see in the editor or with regular rendering, how can I make the baked lightmap look closer to the realtime rendering? which lightmap settings should I adjust? I set the lightmap environment mode to “Custom Sky”, but it doesn’t seem to improve the quality
after baking, do I need to delete the WorldEnvironment and sunlight if I want to rely only on the lightmap for lighting?
how can I switch between realtime rendering and lightmap during runtime? I would like to have a quality option in the game: high quality uses realtime lighting, and low quality uses the lightmap, I assume I have to toggle the visibility of the lightmap node to turn it on and off, but I’m not sure
I don’t understand why shadows are still realtime when playing the game, even though the sunlight is set to static, could you explain this? I think I may have misunderstood what “static” actually means, also, what’s the real difference between static and dynamic lighting options?
thanks for the replies, look at these images to understand the context
yes. the UV2 is used.
make sure it’s not too big since it can be a problem for mobile. you can select the exr file which is the image and see it and the size it has. I think anything below 1024x1024 should work in any platform, 4096x4096 should work in most PCs and will give you a good enough quality, and higher will require a better GPU to work, and take more time to render.
baked lightmap and realtime will never look the same. baked uses raytracing so it is perfectly accurate (depends on quality and size of image) while realtime is an aproximation and doesn’t take GI into account, only shadows.
so baked will have bounces that add more light and make shadows softer and illuminate interior scenes that would otherwise be in shadow.
I can’t tell you what your problem is from the pictures. what I see is that the shadows are less dark with lightmapGI, this is because it’s taking into account the bounced light. dark areas will also be darker with lightmapGI, which is what we want for realistic scenes.
keep in mind, not all games need GI, this level is very stylized, so if there is so little difference, maybe it’s not worth to use lightmapGI. I would test it to see if static works better or dynamic shadows, since you are targeting mobile.
the recommended settings to change are to enable supersampling, which will improve quality, and enable direction if you have normal maps.
next would be increase quality, which will make the render slower.
and increasing the image size will improve the result but also increase the resources used in game.
no. the sun should not do much unless the mesh is seen from afar, so it could be deleted.
if the entire level is baked, sure. lightmapGI relies on light probes for shadows and light.
for the environment, there must be ONE environment in the scene, because it controls things like color, sky, GI, etc.
that is not how it works.
use dynamic light if you need the lights to move, or if you have day-night cycle (although baked could be used, but it would take more work), dynamic also casts shadows on moving objects like the player.
baked is a form of GI, and a very accurate and cheap one, it should be used for maps where things don’t move much, and it can be combined with real-time to add shadows.
so I would add duplicate lights set to dynamic, and show-hide/instantiate-delete them when the setting is changed. they would add to the lightmapGI, not replace it.
lightmapGI has better quality than SDFGI and other ones, except maybe VoxelGI.
they are not. you will see shadows cast onto objects, that comes from the lightprobes. you can add additional lightprobes on corners that don’t have them to improve quality.
but objects should not cast shadows of their own, that’s why sometime you need a spotlight or omnilight to add shadows if they will be visible, like if a character will walk in front of a torch in a corner.