Archived

This topic is now archived and is closed to further replies.

mathijs

stencil shadows

Recommended Posts

Heya everyone, Ihve got a little problem with stencil shadows. I have used the Nehe stencil shadows sample and copied most of the functions in my project. The first pass of the stencil shadow seems to do what it has to but the second pass removes the complete shadow. The following screenshots show this. http://home.planet.nl/~baaij067/pass1.jpg http://home.planet.nl/~baaij067/pass2.jpg Here follows parts of the code that arent directly from NeHe sample. GLmatrix16f Minv; GLvector4f wlp, lp; lp[0] = LightPos[0]; lp[1] = LightPos[1]; lp[2] = LightPos[2]; lp[3] = LightPos[3]; glDisable(GL_TEXTURE_2D); glColor3f(1,1,1); glBegin(GL_QUADS); glNormal3f(0.0f, 1.0f, 0.0f); // Normal Pointing Up glVertex3f(-10.0f,-10.0f,-20.0f); // Back Left glVertex3f(-10.0f,-10.0f, 20.0f); // Front Left glVertex3f( 10.0f,-10.0f, 20.0f); // Front Right glVertex3f( 10.0f,-10.0f,-20.0f); // Back Right glEnd(); glEnable(GL_TEXTURE_2D); glTranslatef(0,0,0); DrawGLObject(tempShad); CastShadow(&tempShad, lp); glDisable(GL_LIGHTING); The lightning position isnt ok yet but i had a few problems with it so i did it like this to fix it as soon as the shadows work. If anyone needs another part of the source tell me. Thanks alot Mathijs

Share this post


Link to post
Share on other sites
Very hard to help you here kid! - ive done some shadows me self, but dont remember getting this problem. One fix i would recommend (if you arent doing it already) is that you ensure you render the shadow LAST, as writing to the stencil buffer after you have done the shadow willmean shadows dont get cast on them objects


Duont know if that makes sense, but let us know if it fixes the prob!


Cheers
----------------------
Love Games?

www.brownmonster.co.uk
----------------------

Share this post


Link to post
Share on other sites