shadow2DRect

Hi,
I use a sampler2DRectShadow and the shadow2DRect lookup function to implement hardware shadow map in a rectangular floating point texture pipeline. All works well, but actually I found the shadow2DRect function by myself according the orher function and sampler names. I would like to know if anybody has a link or some documentation about this function and if it is supported by the new graphics card. I did that on a nVidia FX 5700.

Then I also would like to know if a way to set up the texture compparison function and mode to allow shadow2DRect to return 0 or 1 instead the shadow depth in order the don’t have to perform the depth comparison by hand.

  
void main (void)
{
	float epsilon = 0.000001;
	vec4 defaultColor = vec4(0,1,0,1);

	vec2 rect = vec2(imageWidth,imageHeight);

	vec2 txc = vec2(gl_TexCoord[0]);

	float pointDepth  = ProjShadow.z/ProjShadow.w;
        vec3 txcd = vec3(txc,pointDepth);
 
	float shadowDepth = shadow2DRect(shadowMap, txcd).r;
        if (inRect(rect,txc) == false) discard;  
        if (pointDepth > shadowDepth + epsilon)  discard;
	gl_FragColor.r = texture2DRect(fptexture, txc).r	gl_FragColor.g = texture2DRect(fptexture, txc).g;
	gl_FragColor.b = texture2DRect(fptexture, txc).b;
	gl_FragColor.a = 1.0;

	gl_FragColor *=expstop;
	
}

Thanks,
Charles-Félix.

Well, on NV hardware GLSL actually uses the Cg Compiler so Rect Textures were already supported, but officially (going by the GLSL spec) Rect textures are ‘for future release[s]’, so you’ll have to wait for any oficial docs.

Also, Why do you call texture2DRect() so many times? by looking at it i can see that u can change it to:

gl_FragColor.rgb = texture2DRect(fptexture, txc).rgb;

Twixn

First, Thanks for your reply.
Actually you’re right for texture2DRect, the reason is that I was in debugging session, and debugging modification after debugging modification the code became like that…

But I would like to know now if there is a way to use recangular depth map without sampler2DRectShadow and shadow2DRect.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.