Jump to content



trying to find the pros and cons with shadows?

  • You cannot reply to this topic
4 replies to this topic

#1 thedodgeruk   Members   -  Reputation: 112

Like
0Likes
Like

Posted 05 December 2011 - 06:49 AM

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

Ad:

#2 kauna   Members   -  Reputation: 383

Like
0Likes
Like

Posted 05 December 2011 - 07:14 AM

View Postthedodgeruk, 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 MJP   Moderators   -  Reputation: 2118

Like
0Likes
Like

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 BattleMetalChris   Members   -  Reputation: 146

Like
0Likes
Like

Posted 06 December 2011 - 06:53 AM

View Postkauna, 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 kauna   Members   -  Reputation: 383

Like
0Likes
Like

Posted 06 December 2011 - 07:48 AM

View PostBattleMetalChris, on 06 December 2011 - 06:53 AM, said:

View Postkauna, 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!






We are working on generating results for this topic
PARTNERS