Sign in to follow this  

Calculating Shadow Geometry

This topic is 4222 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I'm sure this has been asked, but I'm having trouble finding anything specific when searching through things. I wanted to find out about calculating the shadow volume geometry for my levels. Everything I find has information about calculating adjacency and etcetc, but it's A) all index based (the models use the index buffer, and adjacency is calculated off the indices), and B) using whole (no holes in them) models. My world is made up of sectors, with doors from one sector to another. These doors cause holes in the models (and I don't want to calculate one big buffer). Mostly, I am looking into GPU assisted stencil shadows, create extra geometry when needed for the models, and let the GPU extrude the volumes, but I don't know if this will work with how I handle my levels. On another note, shadows, in general, seem to have slowed down in advancement. I haven't seen much lately for new shadowing techniques, am I just missing a lot?

Share this post


Link to post
Share on other sites
Shadow volumes cant be reliably extruded from open meshes...so basically if you have walls with holes in them you have to somehow preprocess them to be closed.

Basically shadowing methods are now mostly going in the image space direction: i.e. shadow mapping. Shadow volumes are so limiting that they are not a good solution for many applications.

Share this post


Link to post
Share on other sites
Quote:
Original post by Matt Aufderheide
Basically shadowing methods are now mostly going in the image space direction: i.e. shadow mapping. Shadow volumes are so limiting that they are not a good solution for many applications.


Agreed. I saw a recent post over in the DirectX forum hyping the geometry shader mechanism in DX10 as a viable way to generate shadow volumes -- but I'm still not sold. Also, what about transparent and alpha tested surfaces??? With an image based solution all of this stuff is dealt with in a much more "unified" and elegant way.

Share this post


Link to post
Share on other sites
Yeah, I tried looking into stencil shadows, and while still a nice method, are nice too limited. I have my shadow mapping re-implemented into my engine (and a much cleaner implementation this time, sweet), but am back to my original reason for looking elsewhere. Primarily, aliasing artifacts, it can be solved a bit by up'ing the resolution of the shadow maps, but at the cost of performance. I know there are numerous techniques to even out the shadow maps, so that the pixelation becomes less apparent, but have any of these methods become more refined or robust?

Share this post


Link to post
Share on other sites
Quote:
Original post by xycsoscyx
I know there are numerous techniques to even out the shadow maps, so that the pixelation becomes less apparent, but have any of these methods become more refined or robust?


Yes -- absolutely. There's the variance shadow map implementation which looks promising -- but still has a way to go. I'm not personally sold on it yet.

Then there's arguably other alorithms like perspective and trapezoidal shadow maps. I've found them to have too many pain in the butt special cases to really be robust enough to deal with.

My favorite compromise at this point is cascading shadow maps. There have been a couple of threads floating around here lately about them -- try looking them up.

Share this post


Link to post
Share on other sites
Yeah, the shadow map vs shadow volume decision is complex one, dendent on your game and the target hardware. But generally shadow volumes work better on characters and small objects, if you are trying to use them on arbritary scene geometry you are probably not playing to their strengths, you should consider shadow maps.

Share this post


Link to post
Share on other sites
Wow, busy with work for a few months and BAM. I'm looking up numerous approaches, though a lot seem to be theoretical or purely software implementations. I'll have to look more into cascading shadow maps.

Share this post


Link to post
Share on other sites
Not trying to hijack this thread or anything - but I had a question I was dying to ask for days.

What technique did Splinter Cell (2003, I thought this was something to keep in mind) use? I think they use a shadowmap, but how do they blur the edges so much and make it seem so soft?

Free Image Hosting at www.ImageShack.us

Another thing is that this runs on my Geforce4 MX which does not have hardware depth readback/comparison required for shadowmapping (nor fragment shaders which seem to be required for the new Variance SHadow mapping technique). I have myself implemented a "dual texture" method which, to be frank, looks terribly aliased and far far inferior to the above screenshot.

Share this post


Link to post
Share on other sites
I'm gonna go with percentage closer shadow mapping on the character. For the rest of the game, I'm pretty sure they have some funky dynamic lightmapping stuff going on...

Share this post


Link to post
Share on other sites
Quote:
Original post by deavik
What technique did Splinter Cell (2003, I thought this was something to keep in mind) use? I think they use a shadowmap, but how do they blur the edges so much and make it seem so soft?


You sure this is a shadow map ? It's hard to see, but i don't think there's self-shadowing on the character, which hints that it could be simple projected shadows (and which would also explain why it runs on a GF4 MX).

Y.

Share this post


Link to post
Share on other sites
Quote:
Original post by Ysaneya
You sure this is a shadow map ? It's hard to see, but i don't think there's self-shadowing on the character, which hints that it could be simple projected shadows (and which would also explain why it runs on a GF4 MX).

Y.

That's a good point. I don't know much about projected shadows, however what you can't see in that screenshot is the "swimming" effect which a low res shadow map is famous for. This effect, though almost isn't noticeable because of the blurred nature of the shadow.

This page mentions "shadow buffers" have been used though I have no idea what they are.

Even if it is projected planar shadows, are there techniques for getting soft shadows with them?

If only Splinter Cell could blur the shadow according to distance from caster, I would call it the best shadow ever possible on a Geforce4 MX. [smile]

@acid2: No PCF on a GF4MX [grin]. Also, for the rest of the game the smartest thing would be to use static lightmaps, whose presence are toggled by whether the light is on.

Share this post


Link to post
Share on other sites
Quote:
What technique did Splinter Cell (2003, I thought this was something to keep in mind) use? I think they use a shadowmap, but how do they blur the edges so much and make it seem so soft?

Its kind of hard to see, but I think the grayish pipe on the left wall (in the picture) is not shadowed as it should have been. Then it must be projected shadows not shadow maps.


Quote:
I have myself implemented a "dual texture" method which, to be frank, looks terribly aliased and far far inferior to the above screenshot.

I have implemented PCF shadowmaps in my renderer but the drawback is that its only good for spotlights. I'm trying to use cubic shadow maps instead... but now that you mention the dual shadowmaps wont be bad either. So is it simply using two depth-textures back to back the same way as a single shadowmap is done, or is there something else to it ?

Share this post


Link to post
Share on other sites
Hi Anudh, whereabouts in Kolkata are you?

Quote:
Original post by Anudh
Its kind of hard to see, but I think the grayish pipe on the left wall (in the picture) is not shadowed as it should have been. Then it must be projected shadows not shadow maps.

I think you're correct, but as I said before I don't know how projected shadows work. Are you saying that they are projecting onto 2 planes (wall and floor) and rendering the pipe afterwards?

I'm beginning to take this view as well, since the shadows only show up on floors / walls, not on stairs.
Quote:

I have implemented PCF shadowmaps in my renderer but the drawback is that its only good for spotlights. I'm trying to use cubic shadow maps instead... but now that you mention the dual shadowmaps wont be bad either. So is it simply using two depth-textures back to back the same way as a single shadowmap is done, or is there something else to it ?

Dual texture - that's just 2 textures for the depth comparison. One of them is the depth map and another is a uniform "depth ramp" with values from 0 to 1. The latter is subtracted from the first (texture combiners) so that any un-uniformities in the depth map (shadow casters) show up in the final texture.

You are looking for dual paraboloid shadow mapping I think. While I haven't implemented it, there is a paper by Brabec and many other references on the internet.

Share this post


Link to post
Share on other sites
Quote:
Hi Anudh, whereabouts in Kolkata are you?

I live at Dakshineshwar. (my real name is Anudhyan) :)

Quote:
I think you're correct, but as I said before I don't know how projected shadows work. Are you saying that they are projecting onto 2 planes (wall and floor) and rendering the pipe afterwards?

I did projected shadows a long time back. Yes its like projecting the body (whose shadow is to be drawn) onto a plane. I dont think the order of rendering is important, but GL_POLYGON_OFFSET_FILL should be enabled to eliminate z-fighting between the shadow and the plane its cast onto. Its somewhat like this...


GLfloat shadow_matrix[] =
{
light_y, 0.0, 0.0, 0.0,
-light_x, 0.0, -light_z, -1.0,
0.0, 0.0, light_y, 0.0,
0.0, 0.0, 0.0, light_y,
};
//Draw a body...

glMultMatrixf(shadow_matrix); //start drawing its shadow
glDisable(GL_LIGHTING);
glColor3f(0,0,0));
//Draw the body again
glEnable(GL_LIGHTING);



Quote:
You are looking for dual paraboloid shadow mapping I think. While I haven't implemented it, there is a paper by Brabec and many other references on the internet.

I haven't looked into dual paraboloid shadow mapping, and I've no idea about it, but I want to take advantage of cube maps, those 6 2d textures, for omni-directional shadows.

Share this post


Link to post
Share on other sites
Quote:
Original post by Matt Aufderheide
speaking of Dual paraboloid shadows, does anyone have a sample implementation? I could never get how to construct the matrices..

As I wrote in the earlier post I haven't implemented them - but there are a couple of links which I had marked down (really the internet is full of articles on dual paraboloid [smile]):

http://developer.nvidia.com/object/dual_paraboloid_env_mapping.html
http://www.gamedev.net/columns/hardcore/dualparaboloid/default.asp

Hope that helped

Share this post


Link to post
Share on other sites
I implemented the dual parabolic shadow maps before ending up with my current solution. And I have to say that the results were no good -- for reasons already known. i.e. geometric tesselation was too low and in too many situations the shadows were non-uniformly stretched and deformed -- it was beyond unacceptable.

The only way I'd ever see them becoming usable is if you know if _advanced_ that's the technique you're going to commit to and then have every piece of geometry built with enough tesselation to prevent the artifacting.

Unfortunatly, in a real production environment when things often come online towards the end of a project -- having the art department remodel and or go back and more finely tesselate a world's worth of geometry just isn't an option.

Share this post


Link to post
Share on other sites

This topic is 4222 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this