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 an option to bake only ambient occlusion (AO) with LightmapGI #11596

Open
reyma24 opened this issue Jan 17, 2025 · 1 comment
Open

Add an option to bake only ambient occlusion (AO) with LightmapGI #11596

reyma24 opened this issue Jan 17, 2025 · 1 comment

Comments

@reyma24
Copy link

reyma24 commented Jan 17, 2025

Describe the project you are working on

A 3D game, with a day/night cycle.

Describe the problem or limitation you are having in your project

I use LightmapGI for great looking ambient occlusion between static objects in my game.

However, after I use LightmapGI, I cannot affect baked objects' colors using WorldEnvironment. This makes it impossible to do something like a day/night cycle. Objects just don't become any darker when changing the sky colors / ambient light to black. I believe that's because LightmapGI also bakes in colors bounced from other objects (indirect lighting) ?.

Image
The baked mesh (cluster of balls) does not react to environment lighting.

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

An option to bake only ambient occlusion. Either as an option in LightmapGI or in a new node, like LightmapAO.
So there would be a hybrid solution, where only AO would be baked but it would also allow users to affect colors of objects' shading with ambient lighting. The same way you can bake AO on objects' texture in Blender.

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

A dropdown option in LightmapGI:

  • Bake full
  • Bake AO only

Or a new node:
LightmapAO

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

I don't know.

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

LightmapGI is core.

@Calinou
Copy link
Member

Calinou commented Jan 17, 2025

If there was a way to change the lightmap's color (modulate) at runtime, you could bake lightmaps with a pure white custom color (configurable in the LightmapGI properties) and change the lightmap's modulation according to the current time of day. All your Light3D nodes would need to have their Global Illumination Mode property set to Disabled, so they don't get baked in (as the modulation would also affect them). In 3.x, you could change the lightmap's energy at runtime, which made a limited form of this possible.

Note that the lightmapper does not have a concept of ambient occlusion (see my comment in #10607 (comment)). Instead, what you perceive as ambient occlusion is a byproduct of its pathtracing.

@Calinou Calinou closed this as completed Jan 17, 2025
@Calinou Calinou reopened this Jan 17, 2025
@Calinou Calinou removed the archived label Jan 17, 2025
@Calinou Calinou changed the title Option to bake only Ambient Occlusion (AO) with LightmapGI Add an option to bake only ambient occlusion (AO) with LightmapGI Jan 17, 2025
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

2 participants