Search Unity

Faking Specular Occlusion by plugging baked lightmap texture onto the AO channel

Discussion in 'Shaders' started by NeatWolf, Nov 20, 2019.

  1. NeatWolf

    NeatWolf

    Joined:
    Sep 27, 2013
    Posts:
    924
    Hi there!

    I'm on a project [mobile, OpenGLES 3.0] which makes heavy use of reflection probes (actually, just one per room), and I'd love to find the quickest solution to occluding reflection after baking the lightmaps [Standard PBR pipeline, Gamma color space, Subtractive mode].

    Here's an example of what I'm trying to suppress:


    That is, reflections in areas where AO or just simple lighting should not allow to reveal any reflection.

    The project is almost complete, so I can't (could I?) mass-replace the standard PBR Metallic/Specular shader.

    So I was thinking of just using it on floors and some wall, unless I use those replacement shaders I've heard about and never needed to use until now.

    I downloaded the builtin shaders to have a look, and I guess I should be multiplying the lightmap with the specular brightness of the ref.probe to achieve the result.

    I'm not looking for a "ground truth" result, but for a "good enough" approximation.

    Do you have any tips/hints about where/how it's best to do that?

    I'm looking for a quick&dirty solution that is still iOS/Android compatible, and not too much computational heavy.

    I thought multiplying the overall brightness of the lightmap for the specular/ref probe intensity would have been the fastest way to do that.

    But I guess you may have slightly better considerations (or even more accurate/clever solutions) on this since I'm not writing shaders on a daily (not even weekly) basis, so I was just trying to make minor adjustments on what's working.

    I'm using as a base the Unity builtin shaders for Unity 2019.2.11f1
    (and, UVFree's triplanar shaders)
     
    osmank_02 and OwlBoy- like this.