Archived

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

Xero-X2

Projective Textures, Shadows? how?

Recommended Posts

Ok I have a kind of map. that I want shadowed. the main problem was that i didn''t consider shadowing earier. (big mistake) anyway when looking over ways to do it, I considered what I did in the past. Sloap Terrain light - almost but not quite. Shadow volumes, hard to get silloett, then I saw The new Shadow projections that I have seen. But I have never used these or projective textures, nor have I done this type of shadowing. Could someone spare a moment and point out how to do this. thanks. sorry for any Typos, Im in a bit of a rush to type this out.

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
its similar to lightmaps, search for projective texturing, and project a white bitmap from your sun, it''ll show up as shadows.

Share this post


Link to post
Share on other sites
Ok I looked it up and after a long time of messing with it, I got it to project some screen shot of my game onto my ground, just for the moment at least. But it ends up tiled strangly and dosn''t quite look how I would have planed, but thats ok for the moment, I guess its just because My Camera Dosn''t see all of the ground, I''ll fix that next when I can. But before I do that, I''ll ask this question,

Shadowing, I don''t see how projecting a white bitmap will get me anywhere, All im going to get is a totally white ground, Correct? there needs to be some kind of depth interaction or something dosn''t there?

Could some one enlighten me furture on this subject?

Share this post


Link to post
Share on other sites
look into GL_ARB_shadow its real easy
there is a delphi demo on delphi3d.net

check out my thread GL_ARB_shadow its in this opengl forum

Share this post


Link to post
Share on other sites
Ok I looked it over at Delphi3d and I have come to the conclustion that their method is not quite what I expected, They just use a white textuer with a black teapot rendared into it, I thought you could render a depth buffer of some kind into a texture and use that compared to the projection values, and that could be used to generate the shadows. I came to this conclusion after reading some stuff from nvidia, and after seeing their demos.

is there a way to do this, because I don''t have any Specifed Shadow Casters. I have one Shadow Caster One Shadow Reciver. Meaning Its a kind of terrain, but its not a Height map.

Thanks.

Share this post


Link to post
Share on other sites
The white texture and black teapot was probably the depthbuffer.. (not a caster + reciever). This technique should work nice on your landscape.

Share this post


Link to post
Share on other sites
He does use caster-reciver, he draws the Teapot in black and the rest of the screen in white, then projects this onto the reciver to create a shadow of the teapot.


  
...

procedure TPSForm.UpdateShadow;
begin

// Set a square viewport for the texture:

glViewport(0, 0, S_SIZE, S_SIZE);
glMatrixMode(GL_PROJECTION);
glLoadIdentity;
gluPerspective(90, 1, 1, 1000);
glMatrixMode(GL_MODELVIEW);

// Render the teapot black-on-white:

glDisable(GL_LIGHTING);
glColor3f(0, 0, 0);
glClearColor(1, 1, 1, 1);

glClear(GL_COLOR_BUFFER_BIT or GL_DEPTH_BUFFER_BIT);
glLoadIdentity;
gluLookAt(LCF_O.x, LCF_O.y, LCF_O.z,
LCF_Z.x, LCF_Z.y, LCF_Z.z,
LCF_Y.x, LCF_Y.y, LCF_Y.z);
DrawTeapot;
glBindTexture(GL_TEXTURE_2D, shadow);
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, S_SIZE, S_SIZE);

// Re-enable regular lighting:

glEnable(GL_LIGHTING);
glColor3f(1, 1, 1);
glClearColor(0, 0, 0, 1);

// Reset view:

glViewport(0, 0, ClientWidth, ClientHeight);
glMatrixMode(GL_PROJECTION);
glLoadIdentity;
gluPerspective(60, ClientWidth/ClientHeight, 1, 1000);
glMatrixMode(GL_MODELVIEW);

end;

...


I currently only know how to use Projective textures. Could someone help me with how I would use an image from the depthbuffer of my camera to create Shadows?

Share this post


Link to post
Share on other sites