Big news.
After quite some brainstorming, me and steveL at the darkmod forums finally have a working way to Copy of the depthbuffer in vanilla.
This means its now possible to do proper SSAO / depth tested particles / and pretty much anything else that needs access to the depthbuffer
.
steveL has created a test shader in ARB assembly so you can try out the effect allready.
!!ARBvp1.0
OPTION ARB_position_invariant;
MOV result.texcoord, vertex.texcoord;
END
!!ARBfp1.0
PARAM clipPlanes = { 0.4, 350.0 };
TEMP dpth, col, rng;
TEX dpth, fragment.texcoord, texture[0], 2D;
ADD rng.x, clipPlanes.y, -clipPlanes.x;
MUL col.x, dpth.x, rng.x;
ADD col.x, -col.x, clipPlanes.x;
ADD col.x, col.x, clipPlanes.y;
RCP rng.x, col.x;
MUL col.x, rng.x, clipPlanes.x;
MUL col.x, col.x, 2.0;
MOV result.color.r, col.x;
MOV result.color.g, col.x;
MOV result.color.b, col.x;
MOV result.color.a, 1.0;
END
Productivity is a state of mind.