jitspoe / godot_bsp_importer

An importer addon to import Quake BSP files.
MIT License
98 stars 9 forks source link

Support for static lightmaps #11

Closed degradka closed 8 months ago

degradka commented 8 months ago

Currently, there is no way to set up static lightmaps with this importer, I thought adding lightmaps for a .bsp or .map is impossible, but Qodot has this feature implemented. Are you planning on adding this feature?

jitspoe commented 8 months ago

I just added support for omni lights, but I don't have lightmap support, yet. Not sure when I'll get around to it. I'm really curious how Qodot handles it, as .map files just have the brushes. The lightmap is baked into the .bsp file, so it should be possible to extract that for this importer, but not a .map importer. Maybe it just imports the lights and bakes them with Qodot's lightmap baker?

degradka commented 8 months ago

Maybe it just imports the lights and bakes them with Qodot's lightmap baker?

I don't think so. The only thing that interrupts the lightmap baking process with your importer in Godot is that you can't unwrap the mesh for uv2. For me, on Godot 4.2beta4, I get the error message "the normals are required for uv2 unwrapping" or something similar to this error. However, if I import the BSP into Blender and then import the .blend file with the "static lightmap" checkbox checked, everything bakes flawlessly. Qodot doesn't handle lightmap baking from Trenchbroom; it simply allows the user to enable baking by unwrapping brushes in uv2, and then the user can add lightmap GI in Godot and bake. So something similar to how Godot handles importing .blend files with the "static lightmap" checkbox would be ideal. Edit: I'm not talking about importing lightmap from the .bsp, but generating a static lightmap within Godot by using lightmap GI. Edit 2: That might help https://github.com/QodotPlugin/Qodot/blob/main/addons/qodot/src/qodot_plugin.gd#L195

Yagich commented 8 months ago

this is a 4.2beta 4 issue that will be fixed in the next 4.2 prerelease: https://github.com/godotengine/godot/pull/84374

jitspoe commented 8 months ago

OK, now I generate UV2's on import (but this probably won't work on 4.2 until the next beta comes out). https://github.com/jitspoe/godot_bsp_importer/commit/716fb12f4aceaa1c6a5c2fa27b886701d5bf69f4