How to properly setup BakedLightmap for my gameplay scene?

earlroxasearlroxas Posts: 19Member

Hi guys, I've develop my game (a platformer game) and I really dont know how to properly place and bake a Lightmap.
So this is my Gameplay Scene NodeTree.

As you see, I place the directional light, world environtment, main camera, and player here.
And the Node 'Stages' will child the Stage that player choose in the MainMenu.
Here is how the gameplay:
I have 20 stage scenes, and saved as different scene (.tscn file). In the main menu, player can choose which stage to play. When player choose it, the scene will change to the gameplay scene, and the gameplay scene will instance the stage that the player choose and child it to 'Stages' Node.
Here is example of the stage NodeTree:

The Stage tree compose of this object: 'GridMap' node is the stage layout, and saveral other object like checkpoint, obstacle, etc as child of the other Node.
So what I want to ask is:
1. Where do I put and bake the BakedLightmap? In the Gameplay scene or each one of the 20 stage scene?
2. How to generate lightmap for GridMap?
Thanks for your help.

Answers

  • earlroxasearlroxas Posts: 19Member

    BTW, it is an Android game and using GLES2 Beckend.

  • cyberealitycybereality Posts: 1,090Moderator
    edited January 14

    The baked lightmap I believe would be in your stage scenes so it has access to the geometry. You just create a baked lightmap node somewhere in the tree (probably under your root node of the scene). Then use the orange circles to size it so it covers all the geometry. For the objects to accept baked lighting, you need to click into the mesh and enable "use in baked light". You also have to be sure those models have UV2 maps, but Godot can create them for you (check under the mesh tab on the top when you're in the mesh, you can view UV2 and also pack for lightmapping). Now, you can set then light map size on the mesh to something other than 0,0 (try with low values like 128 or 256 as it can take a long time). And on the light itself, you should change baked mode to indirect (baked mode all should be better but it wasn't working for me). Then once that is all set up, click bake lighting at the top when the baked lightmap node is selected. That should be it.

    All that said, I've had some issues with baked light quality and artifacts, and I'm not sure it's totally working, Please try for yourself and see, maybe I'm doing something wrong, but I get inconsistent results. I will explore further, as I really need this working for my mobile game (real-time lighting is far too slow). I might even consider writing my own lightmapper, I think I can do it, but it would be pretty complex. Anyhow cheers!

  • earlroxasearlroxas Posts: 19Member

    Thanks for the answer! :)

    @cybereality said:
    The baked lightmap I believe would be in your stage scenes so it has access to the geometry.

    Will it works? I mean I place the directional light and environment in Gameplay Scene.
    And also, I place the player (the mesh) in Gameplay scene too. Will the player also affected by lightmapper?

    And how about the Gridmap how should I unwrap the UV2 for gridmap?

  • cyberealitycybereality Posts: 1,090Moderator

    That's a good point. I honestly don't know.

  • earlroxasearlroxas Posts: 19Member

    Well, I'll try it. Thanks for the help. :)

  • CalinouCalinou Posts: 474Admin Godot Developer

    There are known issues with the lightmapper, they should be fixed in 4.0 with the upcoming lightmapper rewrite.

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file