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 AO to LightmapGI #10607

Open
passivestar opened this issue Aug 30, 2024 · 4 comments
Open

Add AO to LightmapGI #10607

passivestar opened this issue Aug 30, 2024 · 4 comments

Comments

@passivestar
Copy link

passivestar commented Aug 30, 2024

Describe the project you are working on

Any 3D project with lightmaps

Describe the problem or limitation you are having in your project

Godot offers screen-space ambient occlusion, but:

  • It's only available in Forward+
  • Having AO in lightmaps will allow you to have a separate larger-radius AO for level geometry, leaving SSAO for finer details and dynamic objects. This way you can fine-tune how AO looks in both large and small crevices
  • Unlike SSAO (or SSIL) baked AO comes at no runtime performance cost

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

No AO AO
noao ao

This was baked in Unity, AO intensity is a little bit exaggerated for comparison

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

Exposed parameters will depend on the implementation, but the LightmapGI node will need at least:

  • Enable Ambient Occlusion
  • Ambient Occlusion Radius
  • Ambient Occlusion Intensity

If possible there could also be Direct/Indirect contribution settings as it can be convenient to be able to reduce the amount of AO in direct light:

image

Project Settings (rendering/lightmapping) can include AO quality settings per quality preset, alongside existing LightmapGI quality settings

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

No

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 Aug 31, 2024

Ultimately, ambient occlusion as drawn in real-time game engines does not exist in real life. SSAO (and even raytraced AO) as we know it are hacks 🙂

Ambient occlusion is a byproduct of how light bounces around. Light has a harder time getting through corners, but it does not suddenly stop whenever it meets a corner. Most pathtracers do not have a dedicated ambient occlusion step for the same reason.

If you find interiors to be lacking in occlusion, you are probably thinking about specular occlusion, which has several PRs improving it:

@passivestar
Copy link
Author

Ultimately, ambient occlusion as drawn in real-time game engines does not exist in real life. SSAO (and even raytraced AO) as we know it are hacks 🙂

Of course 🙂

It's not always about realism, it's about what looks nice. You may be more comfortable calling AO a dirt map than a lighting technique, but are you willing to be that factual in a game engine to the point where you would create a new node that bakes it's own "dirt map" instead of just multiplying it with lightmaps like Unity does? It's simply efficient, it saves you the headache of baking it into individual surface textures

P.S. I've seen the specular occlusion PRs, both of those have my likes. Specular occlusion is def needed as well

@clayjohn
Copy link
Member

How does the AO work here? Is it only applied to to dynamically lights?

In theory AO is already baked into the lightmap as areas of high occlusion will receive less light. So just applying the lightmap to a surface would include physically accurate AO.

I can see two different possible requests here and I don't know which you are asking for, is it:

  1. To have a tweakable AO setting that boosts occlusion when using baked lighting, or
  2. To have a way to bake AO that applies to dynamic lights?

@passivestar
Copy link
Author

@clayjohn Option 1. What I'm suggesting is baked AO same way you get it in Unity, Blender or Substance Painter. And it becomes a part of the lightmap to boost the effect for artistic control, just like in Unity lightmapper. It has no knowledge of dynamic lights

This is intentionally physically-inaccurate effect. It has its own tweakable radius and intensity controls. In Unity it's probably calculated separately and then multiplied with the lightmap if I had to guess

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

4 participants