Go Back   nV News Forums > Linux Support Forums > NVIDIA Linux

Newegg Daily Deals

Reply
 
Thread Tools
Old 02-14-07, 01:37 PM   #1
oc2k1
Registered User
 
Join Date: Aug 2006
Posts: 38
Default GLSL shadow2D() problem

I don't know if that is GLSL compiler bug. My driver version is 1.0.9746:

My thextur is generated by:
glTexImage2D (GL_TEXTURE_2D, 0,GL_DEPTH_COMPONENT , w, h, 0, GL_DEPTH_COMPONENT , GL_UNSIGNED_BYTE, NULL);
Bind as FBO with:
glFramebufferTexture2DEXT(GL_FRAMEBUFFER_EXT,GL_DE PTH_ATTACHMENT_EXT,GL_TEXTURE_2D,texture, 0);

uniform sampler2DShadow Shadowmap;
shadow2D(Shadowmap, vec3(parabol,0.0));

returns the same value than:

uniform sampler2D Shadowmap;
texture2D(Shadowmap, parabol));

The 3rd vec3 component of shadow2Ds firsts argument is always ignored. The shadow2D function shouldn't return something other than 0.0 or 1.0 (except for PCF) (or not?)
__________________
Will code GLSL for food.
oc2k1 is offline   Reply With Quote
Old 02-15-07, 05:24 AM   #2
squeen
Registered User
 
Join Date: Dec 2006
Location: Greenbelt, MD
Posts: 33
Default Re: GLSL shadow2D() problem

This function works consistently for me (several cards, several drivers)

Code:
float lookupShadow(in sampler2DShadow dmap, in vec3 coord, in vec2 offset, const float size)
{
   float depth = shadow2D(dmap, coord + vec3( offset.x,  offset.y, 0.0)*size).r;
   return(depth);
}
where dmap is the shadowmap (don't forget to set the uniform to the right texture image unit, bind it in code etc.), and size is the shadowmap size in pixels (e.g. 2048). Coord comes from the vertex shader
Code:
gl_TexCoord[1] = gl_TextureMatrix[1] * gl_ModelViewMatrix * gl_Vertex;
But you have to have the TextureMatrix for the shadows populated by the eye space->light space transformation, just like with hardware shadow maps.

Hope that helps. Shadows are tricky.
squeen is offline   Reply With Quote
Old 02-15-07, 07:28 AM   #3
oc2k1
Registered User
 
Join Date: Aug 2006
Posts: 38
Default Re: GLSL shadow2D() problem

My shadows are working with a own comparison function. The problem is that I can't use the hardware PCF with that emulation.

And I don't know why the shadow2D() returns the value from the shadowmap instead the comparison with the 3rd value.


That are dualparabolic shadows rendered with 16x AA and two shadowsamples per fragment (efective 8 samples per lightsource, because the 16x MSAA includes a 4x SSAA). With hardware PCF I could get 16 samples per pixel with only one lookup per fragment. (PS: 5 lights are switched off)
Attached Thumbnails
Click image for larger version

Name:	lumina38.jpg
Views:	2455
Size:	78.8 KB
ID:	24063  
__________________
Will code GLSL for food.
oc2k1 is offline   Reply With Quote
Old 02-16-07, 11:18 AM   #4
oc2k1
Registered User
 
Join Date: Aug 2006
Posts: 38
Default Re: GLSL shadow2D() problem

I have forgot that line:
Code:
glTexParameteri( GL_TEXTURE_2D, GL_TEXTURE_COMPARE_MODE_ARB, GL_COMPARE_R_TO_TEXTURE_ARB );


Please move that Topic to the developer section.
__________________
Will code GLSL for food.
oc2k1 is offline   Reply With Quote
Reply


Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


Similar Threads
Thread Thread Starter Forum Replies Last Post
Problem connecting Pioneer VSX-S300 to Nvidia Ion - flat panel scaling solves it? wild_oscar NVIDIA Linux 3 06-17-12 07:18 AM
Post working out problem with 40.xx trying to work problem out, ONLY system specs b5fan NVIDIA Windows Graphics Drivers 11 10-19-02 09:17 AM
nv30 problem rumor bob747b Rumor Mill 37 10-10-02 03:14 PM
kswapd kernel problem and the NVdriver kwaz NVIDIA Linux 2 09-25-02 08:33 PM
Nvidia Go on laptop, black border within XFree86 problem raxip NVIDIA Linux 3 07-31-02 10:58 AM

All times are GMT -5. The time now is 02:10 AM.


Powered by vBulletin® Version 3.7.1
Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Copyright 1998 - 2014, nV News.