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
trying to find the pros and cons with shadows?
Started by thedodgeruk, Dec 05 2011 06:49 AM
4 replies to this topic
Ad:
#2 Members - Reputation: 383
Posted 05 December 2011 - 07:14 AM
thedodgeruk, on 05 December 2011 - 06:49 AM, said:
... 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!
#3 Moderators - Reputation: 2118
Posted 05 December 2011 - 04:13 PM
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.
#4 Members - Reputation: 146
Posted 06 December 2011 - 06:53 AM
kauna, on 05 December 2011 - 07:14 AM, said:
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?
#5 Members - Reputation: 383
Posted 06 December 2011 - 07:48 AM
BattleMetalChris, on 06 December 2011 - 06:53 AM, said:
kauna, on 05 December 2011 - 07:14 AM, said:
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?
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!


















