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

Add a debug draw density property to BakedLightmap #52166

Closed

Conversation

Calinou
Copy link
Member

@Calinou Calinou commented Aug 27, 2021

When enabled, debug_draw_density will draw a checkerboard on the baked lightmap. This is done by modifying the lightmap data itself.

This can be used to diagnose issues related to lightmap texel density and lightmap seams.

Ideally, this would be done directly in the shader to avoid having to bake lightmaps again. I don't know how to implement that though.
Edit: This is likely done by passing the lightmap texture size uniform is debug density is enabled, even if bicubic sampling is disabled in the project settings. However, the issue is that density debugging is configured on a per-node basis rather than a global project setting (like bicubic sampling).

This partially addresses godotengine/godot-proposals#3213.

Preview

debug_draw_density disabled debug_draw_density enabled
Disabled Enabled

When enabled, `debug_draw_density` will draw a checkerboard on the
baked lightmap. This is done by modifying the lightmap data itself.

This can be used to diagnose issues related to lightmap texel density
and lightmap seams.
@s-ilent
Copy link

s-ilent commented Aug 27, 2021

This is a useful feature, but the implementation has some issues.

With this, previewing the lightmap resolution becomes a destructive operation. There is no way to revert it short of rebaking the lightmap. That limits the use of this feature. Being able to preview changes to the lightmap density will then require rebaking the entire lightmap to view the changes against a clean canvas, adding time to iteration.

As a candidate for merging, I think this is a bad proposal. As a stopgap solution, it's okay. But a non-destructive shader based approach is really a better solution with less footguns.

@jcostello
Copy link
Contributor

@s-ilent I completely agree. Its OK for debugin issues before baking as right now we don't have any tool. But as you said, its a destructive method and in the future it will be nice to have it implemented in the shaders.
@Calinou in master there is a debug draw that display the lighting information. Could that be use to apply a texture over it?

@jcostello
Copy link
Contributor

Also, this should work with the lightmap scale property in the object

@Calinou
Copy link
Member Author

Calinou commented Jul 13, 2022

Superseded by #62987, which is a better implementation that doesn't require rebaking lightmaps.

@Calinou Calinou closed this Jul 13, 2022
@YuriSizov YuriSizov removed this from the 3.x milestone Dec 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants