Lights that are only Static
Asked Answered
U

11

0

Hello Godot Community

i'm an XR developer, with a few years experience in Unreal Engine

i'm trying Godot and find it very promising

straight to the point: i'm creating an app for Quest 2, su using the Mobile renderer, on Godot 4.1.1

everything has been quite smooth, but i can't exactly understand how to use the lights

in Unreal i can decide on a per light basis wheter the light is Dynamic, Static (Lightmaps Only) or both

in Godot i have a mesh with a 2nd UV for lightmaps, set as "Static Lightmaps" and Omnilights (12 of them) set as "Static"

as far i understand, building the lightmaps and exporting to Quest, i get only dynamic realtime lights, with heavy impact on performance

obviously i put in the scene a LightmapGI node

any idea please?

my best

Uncanonical answered 19/9, 2023 at 8:33 Comment(0)
E
0

If you have set up the LightmapGI properly, then you should see baked lightmaps on the scene.
Double check that everything is correct: lights visible and set to bake mode static, meshes set to global illumination static and have UV2 (you can check that from Godot) and then bake lightmap to a file. If all this is right, then I'm out of ideas.

If you want to disable the dynamic realtime lights, you can set them to editor-only. Then they will not be enabled when running the app, but will affect lightmap baking.

Elenor answered 19/9, 2023 at 10:33 Comment(0)
U
0

Elenor

Thank you LoipesMas,

  • lights are visible and set to Static(VoxelGI/SDFGI/LightmapGI)
  • mesh is set to Static Lightmap, couldn't check in Godot, but the Blender mesh was exported with 2 UVs, so...
  • lightmap file is in EXR format and it's OK
  • looks like the volumetric part is ok

i had the same idea of baking then turning off the lights before exporting, but as soon as i make each light not visible, its contribution to the viewport shading disappears

basically it seems that both in the viewport and the HMD the lighting is purely dynamic, even if the LMaps have been calculated and saved to file...

Uncanonical answered 19/9, 2023 at 13:1 Comment(0)
U
0

Uncanonical

I went for an "handmade" solution, baking lights in Blender and multiplying the Albedo with the LMap, with added adjustements

it works very well: quality in the HMD is very good as well as the performance, but it's neither an elegant nor practical solution...

Uncanonical answered 19/9, 2023 at 14:3 Comment(0)
E
0

You can check UV2 map by selecting the MeshInstance3D node and clicking the Mesh menu on the topbar:

(but I see that you're using UV2 in your shader, so it's just a bonus tip)

You could also try starting with a simpler scene (one simple mesh and one light) to narrow down the problem space and work from there (if it works).

Baking the lightmaps in Blender is a valid solution (I have done it myself), but it is indeed not practical.
If you figure out what was the problem with the Godot's lightmaps, let us know.

Elenor answered 19/9, 2023 at 17:16 Comment(0)
U
0

Elenor

still no luck with lightmaps, i followed this tut:

but no lightmaps, baaaaaad...

the console, spat an error, don't know if it's related:
"Can't use the compute version of the copy_cubemap_to_panorama shader with the mobile renderer"

am I the only one having this problem? weird...

Uncanonical answered 21/9, 2023 at 14:36 Comment(0)
U
0

Uncanonical

Looks there's a regression since 4.0beta2:
https://github.com/godotengine/godot/issues/66618

it seems weird to me if it's still there in v 4.1.1...

Uncanonical answered 21/9, 2023 at 15:15 Comment(0)
E
0

Weird.
I tried using mobile renderer and it works as well.
Maybe it's a hardware issue. What GPU are you using for baking?

This seems like a bug, so you should probably file a github issue.

Elenor answered 21/9, 2023 at 17:0 Comment(0)
U
0

Elenor

Hi LoipesMas, would you care sharing a basic project where you have lightmaps working fine?

Tryed baking on GTX1070 on Linux Mint and RTX2060 on Win 11, not filing a bug report if i'm the only one having this issue, you use Godot 4.1.1? was thinking about installing a previous version...

Uncanonical answered 21/9, 2023 at 18:11 Comment(0)
E
0

Uncanonical would you care sharing a basic project where you have lightmaps working fine?

Sure, here you go:

lightmap.zip
110kB

Here's how it looks for me when ran:

Elenor answered 21/9, 2023 at 20:57 Comment(0)
U
0

Elenor

Thank you LoipesMas, this helped a lot...

Things I had to fix:

  • export the model as a glTF, since OBJ doesn't export the 2nd UV and Godot doesn't like the one it generates by itself
  • add a Directional Light with 0 energy, otherwise Godot adds directional light by default
  • in LightmapGI set Environment/Mode to Disabled (this one is quite mysterious to me)

I was using OBJ 'cause it imports a clean Mesh, not a Scene, but it seems this is not the way

Uncanonical answered 22/9, 2023 at 10:18 Comment(0)
E
0

Uncanonical
Glad I could help!

add a Directional Light with 0 energy, otherwise Godot adds directional light by default

I'm pretty sure that the added Directional Light is only in preview, not when ran or during baking. You can toggle it in the topbar:

in LightmapGI set Environment/Mode to Disabled (this one is quite mysterious to me)

If you have a WorldEnvironment node in the scene, LightmapGI can use its properties when baking (sky color, etc.). Setting it to Disabled makes it ignore the WorldEnvironement and only use light from static lights.

Elenor answered 22/9, 2023 at 14:5 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.