Search Unity

Ambient Occlusion without an Ambient Light

Discussion in 'Global Illumination' started by Doddler, May 3, 2022.

  1. Doddler

    Doddler

    Joined:
    Jul 12, 2011
    Posts:
    269
    To quickly explain the title, I'm working on emulating an older game art style who's lighting is handled by multiplying the diffuse texture with the ambient color, then adding the lightmap contribution (Diffuse * Ambient + LightMap). To make this work in unity, I bake my scenes' lighting without an ambient light source and handle the ambient color step in a custom (built-in pipeline) shader. This works perfectly fine, but now that I'm looking at using ambient occlusion I'm realizing the issue, without an ambient light in the scene there's obviously nothing to occlude.

    Unfortunately I can see no path to introduce ambient occlusion with this lighting setup. I feel I would need to bake two sets of lightmaps, or separate the ambient contribution from the lightmap, neither of which I'm aware are possible.

    Does anyone have a good idea on how to introduce ambient occlusion when ambient and light contribution need to be separate?
     
  2. kristijonas_unity

    kristijonas_unity

    Unity Technologies

    Joined:
    Feb 8, 2018
    Posts:
    1,080
    There's one, not officially endorsed way of doing it. It requires you to be in Internal mode.
    1. Enable Internal mode by navigating to About Unity window, pressing alt and typing in internal
    2. Open the Lighting window and unroll the Internal Settings header
    3. Enable Export Training Data bool
    4. Rebake
    5. After baking, you will find baked AO texture (among many others) in the root project folder
    Again, I must stress that this was not entirely meant for the end user. I hope it helps.
     
    joshuacwilde and hippocoder like this.