I tried both the integrated unity ambient occlusion that comes with the post-processing stack and another one that someone ported from the Microsoft MiniEngine: https://github.com/keijiro/MiniEngineAO.
Both have the same problem shown with these dark lines below, and the occlusion on the faces around the lines appears to flicker when the camera moves.
I tried solving this problem with Microsoft MiniEngine AO and changing the compute shader. In one of my attempts, I changed the shader's output from the calculated occlusion:
Occlusion(OutPixel) = lerp(1, ao, gIntensity);
to be scanned for the deep texture UV:
Occlusion(OutPixel) = QuadCenterUV.x;
(QuadCenterUV is probably the center of the UV radiation that should be scanned for the 4 deep texture samples 🙂
// Fetch four depths and store them in LDS #ifdef INTERLEAVE_RESULT float4 depths = DepthTex.Gather(samplerDepthTex, float3(QuadCenterUV, DTid.z)); #else float4 depths = DepthTex.Gather(samplerDepthTex, QuadCenterUV);
and that was the output:
With a similar effect on the Y axis. I think that could be the cause because the distortion of the UVs matches the distortion of the effect.
I don't know how to fix this because I don't have enough knowledge about RWBuffer or compute shaders.
My terrain is generated by a noise function as a 2D array, in which a mesh is built, the mesh runs
Mesh.RecalculateNormals()and is then sent to the line filter.
What is the problem here and how can I fix it or can someone fix it for me?