Thank you Clèment.
I got it somewhat working, although I cheated a bit (I disabled the half resolution on the maxzbuffer).
Hopefully if I interpolate manually the half res buffer in the shader I can get good enough results.
By the way, just to be sure. Assuming a full resolution buffer and no floating point errors, in the following code reconstructed and viewPosition should be equal, right?
vec2 uv = get_uvs_from_view(viewPosition);
float sampled_depth = texture(maxzBuffer, uv).r;
vec3 reconstructed = get_view_space_from_depth(uv, sampled_depth);
float delta = abs(length(reconstructed) - length(viewPosition));
If I output delta to an emission shader I get this:
Having a fullscreen pass would be too limiting for artists IMO, and would no longer be compatible with cycles.
I’ll upload a patch to phabricator soon anyway, so we can see there what’s needed to get this into master. For now I was just focused in getting it into a working state.