urp-ssao icon indicating copy to clipboard operation
urp-ssao copied to clipboard

found error in ssao:

Open IgorAherne opened this issue 1 year ago • 0 comments

Watch out, there is an error in the ssao.shader inside the frag() function:

float3 random = normalize( tex2D(_RandomTexture, input.uv * 4.123).rgb ); This has range of [0, 1]

You need to expand the range to [-1,1] which is what the original post contained, like so:

float3 random = tex2D(_RandomTexture, input.uv).rgb;
random = normalize(random*2-1); //NOTICE: normalize AFTER the expansion.

You also need to ensure your texture contains RGB color noise (not black-and-white monochrome)

IgorAherne avatar Dec 17 '23 16:12 IgorAherne