Jump to content
  • Advertisement
Sign in to follow this  
glmisscelan

Projective texturing remove back-projection

This topic is 3849 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

hi, is there any way to remove back-projection using fixed-pipeline and without clipping planes? I have heard something about using 1d texture but i cant find a clear explanation. Thanks in advance.

Share this post


Link to post
Share on other sites
Advertisement
I think you can just say " if (Z coordinate in the lights frame < 0) then it is behind the projector, so don't do the extra 2d texture lookup.

Share this post


Link to post
Share on other sites
Or there is possible to create projective texture volume - (it looks like pyramid) in direction of projected texture and draw texture just in that volume (use stencil tests).

Share this post


Link to post
Share on other sites
Thanks for your answers.

Here are some links with info


http://www.cg.tuwien.ac.at/courses/Realtime/slides/06shading_rtr2007.pdf

"Fold the back-projection factor into a 3D attenuation"

http://www1.cs.columbia.edu/~ravir/6160/papers/shadow_mapping.pdf

"Another problem that comes up with any projective texture mapping is the phantom
“negative projection”. This is actually pretty simple to remove at the cost of an
additional texture unit, or per-vertex color. The goal is just to make sure that the shadow
test always returns “shadowed” for surfaces behind the light."

Projective Texture Mapping - Nvidia Developers

"The sign of q becomes negative behind the projector, which inverts the texture image
in the reverse projection. Typically applications use a 1D texture or other interpolated
quantity to eliminate color contribution when the q coordinate of the projective texture
becomes negative."

http://ati.de/products/imageon238x/IMAGEON_238X_Rooms_Demo_Whitepaper.pdf

"Traditionally, the back projection is resolved by using a 1D texture with a black texture
border and OBJECT_LINEAR texture coordinate generation to fetch a value of black
behind the light plane and white in front of it."

http://216.239.59.104/search?q=cache:57RgGeIZIYgJ:www.cse.unsw.edu.au/~cs9018/lectnotes/ps/pt7.ps.gz+projective+texturing+1d+GL_OBJECT_LINEAR&hl=es&ct=clnk&cd=2&gl=es&client=firefox-a"

"Use a 1D texture that lives in the q plane and
then modulate projective texture by 1D texture."


Every paper talks about a easy way using 1d texture i can understand what they want but i dont know how to code it.

Any help?

Share this post


Link to post
Share on other sites
I found another text that explain it better,

http://www.cbloom.com/3d/techdocs/shadowmap_advanced.txt

"The traditional solution to the "back projection" problem is to use a "clipper" texture (the same way NVidia implements use clip planes in D3D). The clipper texture is a 1x2 texture with one black pixel and one white; you implement texture coordinate generation to create a "u" index into the texture such that the z coordinate of the shadow-generating camera gets mapped to u, with u = 0.5 at the shadow map plane. You then add the texel from the clipper to the shadow map before applying it to the scene (with saturation)."

How can i make this "implement texture coordinate generation to create a "u" index into the texture such that the z coordinate of the shadow-generating camera gets mapped to u"?

Thanks in advanced



Share this post


Link to post
Share on other sites
I was nice enough to pick up my GL book. To do it fixed function, you have to draw the scene twice. It doesn't really say exactly how, but it clearly states that fixed function sucks for it and wont be supported probably (in the near future). Seriously though, people not using shaders.......I don't understand it. Shaders are available on any card that you are going to make a game for.

Share this post


Link to post
Share on other sites
Ok, you win.

I have it working on fixed pipeline (with back projection) i want to remove back projection on glsl but im getting problems, my shadow doesnt scale and translate correctly.

This is a pic on fixed

description of your image


this is with glsl

description of your image


thats the way i set texture matrix,

glActiveTextureARB( GL_TEXTURE2_ARB);
glEnable(GL_TEXTURE_2D);
glMatrixMode( GL_TEXTURE);
glLoadIdentity();
glTranslatef(0.5, 0.5, 0);
glScalef(0.5, 0.5, 1);
gluPerspective(10.0f, (float)conf_get_scr(SCR_WD)/ (float)conf_get_scr(SCR_HG), 0.01, 100.0f);
gluLookAt(-36.80, -10.08, -0.81,
mos->mosinstance[instance].posicion.x,
mos->mosinstance[instance].posicion.y,
mos->mosinstance[instance].posicion.z,
0.0, 1.0, 0.0);

// Set up TexGen
glEnable(GL_TEXTURE_GEN_S);
glEnable(GL_TEXTURE_GEN_T);
glEnable(GL_TEXTURE_GEN_R);
glEnable(GL_TEXTURE_GEN_Q);
glTexGeni(GL_S, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
glTexGeni(GL_T, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
glTexGeni(GL_R, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
glTexGeni(GL_Q, GL_TEXTURE_GEN_MODE, GL_EYE_LINEAR);
glTexGenfv(GL_S, GL_EYE_PLANE, PS);
glTexGenfv(GL_T, GL_EYE_PLANE, PT);
glTexGenfv(GL_R, GL_EYE_PLANE, PR);
glTexGenfv(GL_Q, GL_EYE_PLANE, PQ);

glPushMatrix();




Before render...

glActiveTextureARB( GL_TEXTURE2_ARB);
glBindTexture(GL_TEXTURE_2D, id_texture_stages);
glEnable(GL_TEXTURE_2D);
glMatrixMode( GL_TEXTURE);
glPopMatrix();




and set in glsl

gl_TexCoord[2] = gl_TextureMatrix[2] * gl_Vertex;
//i also try with gl_ModelViewMatrix



Any help?

Thanks in advanced

Share this post


Link to post
Share on other sites
I try
gl_TexCoord[2] = gl_TextureMatrix[2] * gl_Vertex;
gl_TexCoord[2] = gl_TextureMatrix[2] * gl_ModelViewMatrix * gl_Vertex;
gl_TexCoord[2] = gl_ModelViewMatrix * gl_MultiTexCoord2;
gl_TexCoord[2] = gl_ModelViewMatrix * gl_Vertex;
gl_TexCoord[2] = gl_TextureMatrix[2] * gl_MultiTexCoord2;

Nothing works, thanks anyway

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!