Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Port the CPU lightmapper to Godot 4 #3921

Open
Calinou opened this issue Feb 5, 2022 · 0 comments
Open

Port the CPU lightmapper to Godot 4 #3921

Calinou opened this issue Feb 5, 2022 · 0 comments

Comments

@Calinou
Copy link
Member

Calinou commented Feb 5, 2022

Related to #3920.

Describe the project you are working on

The Godot editor 🙂

Describe the problem or limitation you are having in your project

Godot 4.0 has a GPU lightmapper which is fast and can bake high-quality lightmaps, but it has two limitations:

  • On GPUs that have little video memory, the GPU lightmapper can be unstable on large, complex scenes.
  • On systems that have a CPU that is much faster compared to the GPU, a CPU lightmapper will typically be faster and more stable.
  • When using the OpenGL renderer, lightmaps cannot be baked as the GPU lightmapper requires Vulkan support by design. It's not possible to make the GPU lightmapper run on OpenGL due to the complexity required.
    • Lightmaps baked with a GPU lightmapper can still be displayed with an OpenGL renderer, but from an editor perspective, this would require switching to Vulkan and restarting the editor every time you wish to bake lightmaps.

Describe the feature / enhancement and how it helps to overcome the problem or limitation

Port the CPU lightmapper from Godot 3.x to Godot 4.

Describe how your proposal will work, with code, pseudo-code, mock-ups, and/or diagrams

There are a few challenges to porting the CPU lightmapper:

  • Dynamic object capture needs to be rewritten to use a format compatible with the GPU lightmapper. The octree approach used in 3.x wasn't very efficient anyway (on top of requiring very large files to be saved on disk).
  • The CPU lightmapper currently doesn't support directional lightmapping1 (which allows for more accurate lighting). For feature parity with the GPU lightmapper, this would need to be implemented. However, given the low-end focus of the OpenGL renderer (where the CPU lightmapper will be the most popular), it may not make sense to support this in the CPU lightmapper.

If this enhancement will not be used often, can it be worked around with a few lines of script?

No, as a lightmapper can't be implemented in a few lines of script.

Is there a reason why this should be core and not an add-on in the asset library?

Lightmappers need to be implemented in core to be fast.

Footnotes

  1. Directional lightmapping has no relation to DirectionalLight nodes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant