Hi,i'm intereasted in making a hard shadow(using a projection matrix) .I tryed a formula but i didn't get the result i've expected so i wouldn't mind if you gave me an explanation.
A*x+B*y+C*z+D=0;
And the projection matrix would be the one below:
|1 0 0 0|
|0 1 0 0|
|0 0 1 0|
|-A/D -B/D -C/D 0|
My problem is that i have a floor at y=-1.0f on which i want to project my object.I said that the equation of the plane is in this case "y+1=0" i hope i'm right.
The algorithm given is:
========================
float P[16]={1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,0};
glMatrixMode(GL_MODELVIEW);
glPushMatrix();
glPushAttrib(GL_LIGHTING_BIT);
glTranslatef(lx,ly,lz);/* why translating into the light position?*/
D=D+A*lx+B*ly+C*lz;/* what is this for?*/
P[3]=-A/0.999*D;/*what is this for*/
P[7]=-B/0.999*D;
P[11]=-C/0.999*D;
glMultMatrixf(P);
glTranslatef(-lx,-ly-lz);[looksaround]
...............DrawObject..............
glPopAttrib();
glPopMatrix();
Since i don't understand it i can't find the error i'm making so please explain to me what is going on in this algorithm or if you have a better way to do it and know well the algorithm please give it to me,some explanation won't hurt.Also i can't understand where the matrix comes from
Thanks for your help.