 Ok so here I go, amateur me goes to learn how to do shadows… Oh man, OpenGL won’t do it for me… Ok so I go look for tutorials… Then we find the shadow matrix … Now I got smart and just figured, if that is the standard for shadowing in OpenGL, I can just copy and paste =-).

So here’s my problem. I have a sphere and a plane. I have a working shadowMatrix command and want to now: what variables, arrays and stuff that needs to go in the display code to get my shadows visible on the plane. I got reflections down and this is the only thing that hinders me =-(…

You’ll only need the shadow matrix. Render your scene. Determine the plane to render the shades on. Set the projection matrix, render in your favorite shade color Divide Overflow

“I’m fat, you’re ugly, I can lose weight…”

Yah, I got that general idea down but I need the code for it  cwhite40 There’s a good description in the back of the red book. I think there’s even some example code in the glut distribution somewhere.

You should check nVidia web site, they have a projected shadow demo.

They are other infos about that on this web site, in the tutorial section.

Ok this really is not working. The glut code and nVida code are not well explained. I have no idea what to do here . Does anyone have well explained shadow code. I have tried this so many times I think I’m going to turn into a shadow . cwhite40    I took the code form Mark Kilgard from nVidia corporation…

float pA, float pB, float pC, float pD,
float vX, float vY, float vZ, float vW)
{
float Dot = pA * vX +
pB * vY +
pC * vZ +
pD * vW;
mat = Dot - vX * pA;
mat = -vY * pA;
mat = -vZ * pA;
mat = -vW * pA;
mat = -vX * pB;
mat = Dot - vY * pB;
mat = -vZ * pB;
mat = -vW * pB;
mat = -vX * pC;
mat = -vY * pC;
mat = Dot - vZ * pC;
mat = -vW * pC;
mat = -vX * pD;
mat = -vY * pD;
mat = -vZ * pD;
mat = Dot - vW * pD;
}

Use this matrix this way:

float mat; // This is the sahdow matrix

0.0, 1.0, 0.0, 0.0, // The plane
0.0, 10.0, 0.0, 1.0 ); // The light position

render some geometry…
glPushMatrix ();
glMultMatrixf (mat);
render the same geometry…
glPopMatrix ();

I hope this will help…

Cool!!

One more question though, what is the plane parameters supposed to be: vertices, points, normals?

Thank You        cwhite40 the a,b & c parameters represent the plane normal the d parameter represent the lenght of this vector.