Stencil shadows
BlitzMax Forums/OpenGL Module/Stencil shadows
| ||
From what I gather from the NeHe tutorial, to draw a stencil shadow, you basically just project every edge of the mesh in one direction. If you had a triangle between A, B, and C, you would create a quad out of A and B, and two other vertices offset by the vector of the shadow. I'm rather surprised that you actually have to adjust the vertex array in real time. Isn't there a way to do it so that this is automated somehow? Is that really how it is done in Doom 3? |
| ||
I think they use vertex shaders. But I'm not even remotely certain of that. |
| ||
It doesn't require vertex shaders, since it runs on my GEForce 4. That will be kind of fun to program. |
| ||
Well, if they do do it in software, that might explain why the characters have so few polygons, and why there are so few of them on screen at once. |
| ||
What about a more conservative use of them, like in HL2? Is that all calculated in real time? Do they extend and draw all the edges or just the silhouette edges? |
| ||
I think even in Doom they only draw the silhouette edges. I seem to recall reading that. I'm pretty sure you'd find an article about it on Gamasutra.com Also, I wouldn't be surprised to learn that they use vertex shaders for calculating them, and only fall back to software if need be. |
| ||
HL2 does not use stencil shadows afair (as far as i remember) its just "render to texture/projected" stuff |
| ||
Yeah, HL2 uses shaders to help create the shadow, but in the end it's a projected texture. |
| ||
What about torque and unreal tournament 2004? they don't require any shaders at all and have fast soft character shadows. |
| ||
There's an addon for Torque which permits use of stencil shadows, but I'm not sure if that's what you mean. Probably not since you say soft, and stencil shadows are not soft unless they are processed somehow. Unreal Tournament 2004 definitely uses projected shadows for characters. |
| ||
You know, I could use a super low-poly stencil mesh to cast shadows with. It would cut the processing time down a lot, and would look about the same when projected as a shadow. |
| ||
Halo: Not if you want objects to self shadow. And I'm not sure that you can use stencil shadows without automatically having self shadowing. If you try to, I think you will find you get all sorts of shadow artifacts as a result. Portions of the model in shadow which should not be, and vice versa. |
| ||
I'm getting good results with projected textures. I'll stick with those for now. Having the gl clip planes sure is a help, because you can cut off the sections of a surface that would just be empty fill anyways. |
| ||
I got projected shadows working super-fast. This is pretty fun:![]() |
| ||
looks good :] |
| ||
Halo: I'am a long time interested on projective shadows. There is no problem to render the shadow to the texture, but how to project this depthtexture. I have code any testversions, but if I project the texture not from the camera, they looks not ok. So can you post a little example? The most importend thing for me is, how the texture matrix have to build(just like using the inverted matrix of the lightentity etc.). cu olli |
| ||
Just set up automatic texture mapping with OBJECT_LINEAR, calculate the texture mapping planes, clamp the texture, add clipping planes to trim off the unwanted portions, and re-draw the object. |