From: Wolfgang Engel <wolfgang.engel@gm...>  20070413 00:16:23

Hey Martin, can you share how you texel align the shadow map in shadow projector space? This sounds interesting.  Wolfgang On 4/12/07, Martin Valigursky <dream.gfx3d@...> wrote: > I did similar thing on our last project with few changes: > > 1. The rotation of the shadow map in world space is fixed (so say u and v > axis of shadow map are always parallel with world x and y axis (ground > plane)). > 2. I texel align shadow map in shadow projector space ... so that when the > projected shadow map moves (because scene frustum moves), texels don't > slide. > > This way I was able to use even pretty low density of shadow map texels  > even 2 texels per meter was acceptable for static geometry (on low spec > machine). There was no pixel flickering at all when the camera was moving or > rotating. > > Martin > >  Original Message  > From: "Wolfgang Engel" <wolfgang.engel@...> > To: "Game Development Algorithms" <gdalgorithmslist@...> > Sent: Friday, April 13, 2007 1:26 AM > Subject: [Algorithms] Othographic Light View Frustum > > > > Hi, > > I spent some time to think about the best way to generate an > > orthographic light view frustum for "fullscreen" shadow maps. I > > actually use code to do this since a long time but I always perceive the > > resulting frustum as too big. > > The idea is to tightly fit the light frustum around a slice of the > > viewer's frustum. > > Here is how I do it: > > > > 1. determine a slice of the camera view frustum > > 2. calculate a near and far plane for this > > 3. transform in light space > > 4. take the extrema and build a bounding box > > 5. found the center of this box and transform it to world space > > 5. construct the orthographic frustum from this box > > > > By transforming to light space and then taking the extrema, you get a > > box that encloses one frustum slices. The problem is now > > rotation. Let's say you contruct the light view matrix upfront just by > > setting up fixed x and y vectors that just follow the z == light > > direction vector. If you rotate the camera view under the light what > > happens is the following: the enclosing orthographic light frustum will > > rotate around the camera view frustum slice, just by changing its shape. > > So in worst case it would look on the figure above like a diamond. There > > are two issues attached to this: the diamond is not necessarily the most > > efficient form to enclose the slice and second the rotation shows up in > > the result, because the render target will rotate with it. You can see > > the shadow flicker because of this. > > What I did now is a kind of hack: I used the direction of the camera and > > the x axis of the camera and "crossproduct" them to the light > > direction. The result is better than before. > > > > Do I do anything substantially wrong and is there a better way to handle > > all this? > > Maybe I am completely off here ... > > > > > >  Wolfgang > > > >  > > Take Surveys. Earn Cash. Influence the Future of IT > > Join SourceForge.net's Techsay panel and you'll get the chance to share > > your > > opinions on IT & business topics through brief surveysand earn cash > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > _______________________________________________ > > GDAlgorithmslist mailing list > > GDAlgorithmslist@... > > https://lists.sourceforge.net/lists/listinfo/gdalgorithmslist > > Archives: > > http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithmslist > > >  > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share your > opinions on IT & business topics through brief surveysand earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > GDAlgorithmslist mailing list > GDAlgorithmslist@... > https://lists.sourceforge.net/lists/listinfo/gdalgorithmslist > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithmslist > 