Crytek SSAO implementation producing odd result

71 Views Asked by At

I have been trying to better match my SSAO to Crytek's original implementation. Their Finding Next Gen - CryEngine 2 document states

To reduce the sample count we vary the sample position for nearby pixels. The initial sample positions are distributed around the origin in a sphere and the variation is achieved by reflecting the sample positions on a random 3D plane through the origin

I have implemented this as the following: Full Shader

vec3 plane = texture(texNoise, uvCoords * noiseScale).xyz - vec3(1.0);

for(int i = 0; i < ssao.sample_amount; ++i) {

    vec3 samplePos = reflect(TBN * ssao.samples[i].xyz, plane);
    samplePos = viewSpacePositions + samplePos * radius;
    /....
 }

My result appears far from the original Crytek SSAO implementation with an overall odd look and occlusion seemingly only appearing on the right side.

enter image description here

0

There are 0 best solutions below