PDA

View Full Version : A Demo - Post Process Depth Discontinuity Edge AA



pocketmoon
04-23-2006, 07:29 AM
http://www.wavestate.com/depthEdgeAA.zip

This is a work in progress but it's a good time to see if this works on anything other than a 6800GT It's OpenGL/GLSL and required glut (http://www.xmission.com/~nate/glut/glut-3.7.6-bin.zip)

Basically it applies an AA filter as a Post Process, which could be usefull if your rendering to an FP target for HDR etc.

The filter is only applied where there's a discontinuity in the depth, e.g. at depth edges. The Image is rendered to capture both the depth and the actual rgb scene to offscreen rendertargets. A Canny edge filter is applied and the resulting 'edge map' is then dilated to capture pixels both sides of the depth edge.

When the capured scene is rendered (full screen quad) to the backbuffer for display, a 12-tap poisson disc filter is applied but only to those pixels which share a depth edge.

space bar toggles the filter
r rotates on/off

Rob

Humus
04-23-2006, 12:32 PM
This is what I get on an X1800XL AIW.


glift::CheckFramebufferStatus() ERROR:
GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_EXT
Filter shader 1 could not be linked
**************** ***************** ***************** **************** **************The last garbage (which is repeated several pages) I would guess means you didn't terminate the string with '\0'.

Humus
04-23-2006, 12:46 PM
vec4 edge = (0,0,0,0);
should be
vec4 edge = vec4(0,0,0,0);

Array declarations must be done this way. C/C++ style is not allowed in GLSL.

vec2 poisson[12];
poisson[0] = vec2(-0.326212, -0.40581);
poisson[1] = vec2(-0.840144, -0.07358);
poisson[2] = vec2(-0.695914, 0.457137);
poisson[3] = vec2(-0.203345, 0.620716);
poisson[4] = vec2(0.96234, -0.194983);
poisson[5] = vec2(0.473434, -0.480026);
poisson[6] = vec2(0.519456, 0.767022);
poisson[7] = vec2(0.185461, -0.893124);
poisson[8] = vec2(0.507431, 0.064425);
poisson[9] = vec2(0.89642, 0.412458);
poisson[10] = vec2(-0.32194, -0.932615);
poisson[11] = vec2(-0.791559, -0.59771);

To use texture2DLod() in a fragment shader you need this code since this is not standard GLSL:

#extension GL_ATI_shader_texture_lod : require

With these changes all shaders compile fine, but "Filter shader 3" still can't be linked. It's wasn't obvious to me which shader that is and I didn't see any more errors.

pocketmoon
04-23-2006, 02:16 PM
Thanks Humus, I'll look into it.