I recently found out why my SSAO isn't looking so grand. The following was grabbed from Frank Luna's SSAO code:
XMMATRIX T = XMMATRIX(
0.5f, 0.0f, 0.0f, 0.0f,
0.0f, -0.5f, 0.0f, 0.0f,
0.0f, 0.0f, 1.0f, 0.0f,
0.5f, 0.5f, 0.0f, 1.0f);
// T = XMMatrixTranspose(T);
XMVECTOR det2;
// XMMATRIX P = XMMatrixTranspose(PROJ);
XMMATRIX PT = XMMatrixMultiply(PROJ,T);
screenCB->gViewToTexSpace = PT;
The depth being sent to the final SSAO shader file is the input.position.z by world * view * projection.
Inside the SSAO shader where ProjQ is muliplied by the gViewToTexSpace (bringing NDC to Texture Space);
// Project q and generate projective tex-coords.
float4 projQ = mul(float4(q, 1.0f), gViewToTexSpace);
projQ /= projQ.w;
I get the following result with blurred on top of it:
[attachment=28511:ScreenCaptured_nossao04207225.jpg]
As you can see it's pretty messy and doesn't look like Frank Luna's SSAO or any other typical SSAO.
It's a bummer too and I would like to get this to work. I'm bad at matrix math but I'm guessing the projected texspace is taking the projection matrix * 0.5f + 0.5f;
So here I am stuck