Jump to content
  • Advertisement
Sign in to follow this  
thedodgeruk

trying to find the pros and cons with shadows?

This topic is 2560 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

shadows re a major part of a game but are also very expensive to render dynamically .
the way i got taught was to to render the scene from the lights point of view , use the light like a camera , to create the shadow map ,
then use this will lighting calculations to get the desired effect
i have seen in the directx SDK that there is a way to do them via the gemetry shader

but i cant find any information about the pros and cons about each method, ie the cost

which is faster becuase i figure the geometry shader would be , but would like to make sure before i impliment shadows in my tech demo

Share this post


Link to post
Share on other sites
Advertisement

... i have seen in the directx SDK that there is a way to do them via the gemetry shader ...


The geometry shader may be used to multiply/duplicate the rendered geometry to multiple render targets. Ie. you may draw meshes with single draw command to all 6 sides of a cube map or you maybe draw shadowing object to different splits in cascading shadow maps.

As opposed to performing the drawing routine as many times as there are render targets, the geometry shader should be faster. I did implement cascading shadow maps with geometry shader and I was rather disappointed with the performance.

Geometry shader isn't necessary for calculating shadow maps. You may render your shadow maps without it and the performance could be equal to the geometry shader version.

Optimizing (dynamic) shadow drawing has the same rules as optimizing normal scene rendering. Less you draw, less time it takes. It is rather difficult to see if there are some missing shadows, especially for distant objects. Also, it is very very difficult to see if the shadow has actually the same geometry as the "casting object" so you may use a lot coarser model when drawing the shadow map.

Another trick is also to use a static shadow map (updated rarely or never) for objects at certain distance and further.

Best regards!

Share this post


Link to post
Share on other sites
Yeah I've tried using geometry shaders for cascaded shadow maps, and they kinda suck. It reduces your CPU overhead, but it's almost always much worse for GPU performance when rendering the actual shadow map. If you want lots of shadows, then making your shadow map rendering as quick as possible is critical.

Share this post


Link to post
Share on other sites

Also, it is very very difficult to see if the shadow has actually the same geometry as the "casting object" so you may use a lot coarser model when drawing the shadow map.


I was thinking of implementing this in the demo I'm making, but wouldn't it create some really horrible self-shadowing problems due to the geometry of the shadow being slightly different to that of the object?

Share this post


Link to post
Share on other sites

[quote name='kauna' timestamp='1323090873' post='4890688']
Also, it is very very difficult to see if the shadow has actually the same geometry as the "casting object" so you may use a lot coarser model when drawing the shadow map.


I was thinking of implementing this in the demo I'm making, but wouldn't it create some really horrible self-shadowing problems due to the geometry of the shadow being slightly different to that of the object?
[/quote]

Sure it will, but once again, correct self-shadowing is difficult to see from distance depending of course on the type of the object. You may still use higher detail object for rendering shadows nearby camera. Simply put, you may use the same level-of-detail objects for shadows and normal rendering, just that when rendering shadows you may drop the level-of-detail faster.

Best regards!

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!