Hi @vacuumhack, I’m taking a look at this code, and I haven’t fully absorbed everything going on yet but wanted to share a few errors and fixes I’ve found.
So in this area of the shader, you are creating the variable tc_original from sampling the color channels of the render.
void main()
{
vec2 tc_original = texture(sTD2DInputs[0], vUV.st).xy;
// Depth of the current pixel
float dhere = textureLod(sTD2DInputs[1], tc_original, 0.0).x;
// Vector from camera to the current pixel's position
vec3 ray = GetCameraVec(tc_original) * dhere;
const float normalSampleDist = 1.0;
I think this variable is meant to be the UV coordinates. Not sure what tc stands for, but regardless when I assign vUV.st to it, get rid of the color render input to the top, put the depth render there, and change all references of sTD2DInputs[1] to sTD2DInputs[0] I get this:
This seems more like AO, but there’s a few problems. First, there is an invisible plane cutting things off. This is the depth channel, it shouldn’t be 8 bit ever, you almost always more range of values than that. After I changed it to 16 bit depth with out changing anything else, got this:
There’s still some weird stuff going on that I haven’t figured out yet.
Whats’ up with that shadow along the bottom of the image? it was in both images, but changing depth fixed the outline around the edge. Maybe an artifact of this type of AO? maybe too high of a AO distance? Does this method require calculating AO past the normal edges of the render, so that the problem areas can be cropped or something later? I’ve heard of screen space algo’s requiring this.
Also, when you zoom in there’s a weird halo around the geometry? This gets WAY worse when the depth mode is set to 32 bit instead of 16 bit, so it seems related to the contrast. Perhaps this AO method requires a backplane of the scene ? Not sure. Curious if you have insights here:
Lastly (I think haha) There is obviously some intentional (I think?) dithering going on here, maybe to reduce the per frame load, which is spread out over time in some kind of feedback network? I assume you are saving that step for last but wanted to point it out none the less.
I’ll see what else I can find, but wanted to share those findings so far. I’m very interested in a better AO for TD as well that isn’t a resource hog. Nice work so far!
GTAO-AmbientOcclusionGLSLShader-LucasEdit.2.toe (8.9 KB)