Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Question How to only bake Ambient Occlusion?

Discussion in 'General Graphics' started by art_ganymede, Oct 9, 2023.

  1. art_ganymede

    art_ganymede

    Joined:
    Nov 7, 2021
    Posts:
    13
    When you bake a lighting scene with mixed, or baked, lighting colour information from the skybox and lights in the scene, as well as indirect bounce lighting, are included in the lightmap.

    Is it possible to bake just the ambient occlusion, with all other points on the lightmap being white?
    This could then simply be multiplied in shader to add stylised shading to the mesh.





    mockup of what would be desired:

     
  2. c0d3_m0nk3y

    c0d3_m0nk3y

    Joined:
    Oct 21, 2021
    Posts:
    551
    I'm not aware of such a setting but maybe you could trick Unity into doing that. If you crank up indirect illumination really high so that everything becomes white and set AO contribution to indirect lighting to 100%, you should theoretically get what you want. Probably sounds easier than it is. You might have to place a billion lights procedurally (just environment lighting is probably not enough) and replace all materials with white before baking.

    But maybe somebody knows a better way.
     
    art_ganymede likes this.
  3. AcidArrow

    AcidArrow

    Joined:
    May 20, 2010
    Posts:
    11,002
    Six directional lights one in each direction set to baked, no shadows, enable AO bake make sure it affects direct too, no bounces.
     
    art_ganymede and c0d3_m0nk3y like this.
  4. art_ganymede

    art_ganymede

    Joined:
    Nov 7, 2021
    Posts:
    13
    This seems to work really quite well, much appreciated!

    In theory this can now be multiplied in shader to overlay the AO regardless of lighting condition.

     
    c0d3_m0nk3y likes this.