You can subscribe to this list here.
2000 
_{Jan}

_{Feb}

_{Mar}

_{Apr}

_{May}

_{Jun}

_{Jul}
(390) 
_{Aug}
(767) 
_{Sep}
(940) 
_{Oct}
(964) 
_{Nov}
(819) 
_{Dec}
(762) 

2001 
_{Jan}
(680) 
_{Feb}
(1075) 
_{Mar}
(954) 
_{Apr}
(595) 
_{May}
(725) 
_{Jun}
(868) 
_{Jul}
(678) 
_{Aug}
(785) 
_{Sep}
(410) 
_{Oct}
(395) 
_{Nov}
(374) 
_{Dec}
(419) 
2002 
_{Jan}
(699) 
_{Feb}
(501) 
_{Mar}
(311) 
_{Apr}
(334) 
_{May}
(501) 
_{Jun}
(507) 
_{Jul}
(441) 
_{Aug}
(395) 
_{Sep}
(540) 
_{Oct}
(416) 
_{Nov}
(369) 
_{Dec}
(373) 
2003 
_{Jan}
(514) 
_{Feb}
(488) 
_{Mar}
(396) 
_{Apr}
(624) 
_{May}
(590) 
_{Jun}
(562) 
_{Jul}
(546) 
_{Aug}
(463) 
_{Sep}
(389) 
_{Oct}
(399) 
_{Nov}
(333) 
_{Dec}
(449) 
2004 
_{Jan}
(317) 
_{Feb}
(395) 
_{Mar}
(136) 
_{Apr}
(338) 
_{May}
(488) 
_{Jun}
(306) 
_{Jul}
(266) 
_{Aug}
(424) 
_{Sep}
(502) 
_{Oct}
(170) 
_{Nov}
(170) 
_{Dec}
(134) 
2005 
_{Jan}
(249) 
_{Feb}
(109) 
_{Mar}
(119) 
_{Apr}
(282) 
_{May}
(82) 
_{Jun}
(113) 
_{Jul}
(56) 
_{Aug}
(160) 
_{Sep}
(89) 
_{Oct}
(98) 
_{Nov}
(237) 
_{Dec}
(297) 
2006 
_{Jan}
(151) 
_{Feb}
(250) 
_{Mar}
(222) 
_{Apr}
(147) 
_{May}
(266) 
_{Jun}
(313) 
_{Jul}
(367) 
_{Aug}
(135) 
_{Sep}
(108) 
_{Oct}
(110) 
_{Nov}
(220) 
_{Dec}
(47) 
2007 
_{Jan}
(133) 
_{Feb}
(144) 
_{Mar}
(247) 
_{Apr}
(191) 
_{May}
(191) 
_{Jun}
(171) 
_{Jul}
(160) 
_{Aug}
(51) 
_{Sep}
(125) 
_{Oct}
(115) 
_{Nov}
(78) 
_{Dec}
(67) 
2008 
_{Jan}
(165) 
_{Feb}
(37) 
_{Mar}
(130) 
_{Apr}
(111) 
_{May}
(91) 
_{Jun}
(142) 
_{Jul}
(54) 
_{Aug}
(104) 
_{Sep}
(89) 
_{Oct}
(87) 
_{Nov}
(44) 
_{Dec}
(54) 
2009 
_{Jan}
(283) 
_{Feb}
(113) 
_{Mar}
(154) 
_{Apr}
(395) 
_{May}
(62) 
_{Jun}
(48) 
_{Jul}
(52) 
_{Aug}
(54) 
_{Sep}
(131) 
_{Oct}
(29) 
_{Nov}
(32) 
_{Dec}
(37) 
2010 
_{Jan}
(34) 
_{Feb}
(36) 
_{Mar}
(40) 
_{Apr}
(23) 
_{May}
(38) 
_{Jun}
(34) 
_{Jul}
(36) 
_{Aug}
(27) 
_{Sep}
(9) 
_{Oct}
(18) 
_{Nov}
(25) 
_{Dec}

2011 
_{Jan}
(1) 
_{Feb}
(14) 
_{Mar}
(1) 
_{Apr}
(5) 
_{May}
(1) 
_{Jun}

_{Jul}

_{Aug}
(37) 
_{Sep}
(6) 
_{Oct}
(2) 
_{Nov}

_{Dec}

2012 
_{Jan}

_{Feb}
(7) 
_{Mar}

_{Apr}
(4) 
_{May}

_{Jun}
(3) 
_{Jul}

_{Aug}

_{Sep}
(1) 
_{Oct}

_{Nov}

_{Dec}
(10) 
2013 
_{Jan}

_{Feb}
(1) 
_{Mar}
(7) 
_{Apr}
(2) 
_{May}

_{Jun}

_{Jul}
(9) 
_{Aug}

_{Sep}

_{Oct}

_{Nov}

_{Dec}

2014 
_{Jan}
(14) 
_{Feb}

_{Mar}
(2) 
_{Apr}

_{May}
(10) 
_{Jun}

_{Jul}

_{Aug}

_{Sep}

_{Oct}

_{Nov}
(3) 
_{Dec}

S  M  T  W  T  F  S 






1
(17) 
2
(3) 
3
(4) 
4
(14) 
5
(12) 
6
(16) 
7
(28) 
8
(28) 
9
(12) 
10
(5) 
11
(17) 
12
(16) 
13
(37) 
14
(26) 
15
(10) 
16
(1) 
17
(2) 
18
(11) 
19
(9) 
20
(22) 
21
(14) 
22
(23) 
23
(4) 
24
(2) 
25
(16) 
26
(6) 
27
(3) 
28
(5) 
29
(4) 
30
(2) 
From: Michael Pohoreski <MP<ohoreski@cy...>  20021122 19:20:39

Be aware that different books will use or not use a transposed quat>matrix. i.e. "3D Game Engine Design", Page 17, Section 2.3.5, Eqn 2.13 and "Rotating Objects Using Quaterions" (Corrected matrix) Game Developer, Feb 98, Nick Bobick RHCS? 2 2 =20 [ 1  2y  2z 2xy + 2wz 2xz  2wy ] [ 2 2 ] [ 2xy  2wz 1  2x  2z 2yz + 2wx ] [ 2 2 ] [ 2xz + 2wy 2yz  2wx 1  2x  2y ] Used by Watt&Watt, Parameetrization of orientation, Page 362 LHCS? 2 2 =20 [ 1  2y  2z 2xy  2wz 2xz + 2wy ] [ 2 2 ] [ 2xy + 2wz 1  2x  2z 2yz  2wx ] [ 2 2 ] [ 2xz  2wy 2yz + 2wx 1  2x  2y ] Cheers Original Message From: Tyson Jensen [mailto:twjensen@...]=20 Sent: Friday, November 22, 2002 1:41 PM To: gdalgorithmslist@... Subject: RE: [Algorithms] Quaternion handedness Huh? We wrote an entire game in lefthanded coordinates and we never noticed any "magic" preference for righthandedness in matrices. I am unclear as to why arithmetic would care what hand humans tend to prefer. What happens is that care must be taken when copying algorithms out of books that might be making handedness assumptions. I'd bet money that lhA * lhB =3D right handed space is a result of a bias in code, not in = the math. If you have a lefthanded world and use lefthanded transforms your stuff will remain lefthanded. I recommend a constant matrix that can be applied to convert a matrix from lefthanded to righthanded and another one that goes in reverse. I'd recommend doing all your quaternion stuff in (pick a hand) space. If a matrix is (otherhanded) then convert the matrix to the (correcthanded) space, convert to quaternion, do whatever, convert back, and then convert the (correcthanded) matrix back into an (otherhanded) matrix. Trying to maintain lefthanded quaternions and righthanded quaternions is just compounding the problem of having both lefthanded coordinate spaces and right handed coordinate spaces. Original Message From: gdalgorithmslistadmin@... [mailto:gdalgorithmslistadmin@...] On Behalf Of Joseph, William Sent: Friday, November 22, 2002 9:55 AM To: 'gdalgorithmslist@...' Subject: RE: [Algorithms] Quaternion handedness If I understand matrix stuff correctly, a rotationonly matrix is always righthanded  even when working in a lefthanded coordinate system. If your rotation matrix is lefthanded, transforming a space by it will cause that space to switch handedness. For example.. object space A is lefthanded and object>world rotation matrix B is lefthanded. Applying B to A will result in the object appearing righthanded in worldspace... I think. To construct the rotation matrix correctly, you have to do it in the correct space. I'm not familiar with tangentspace transforms.. but you may be able to do this by converting the lefthanded basis to righthanded, extracting the rotation, then converting back to lefthanded. I suggest experimenting.. Will Original Message From: Joe Ante [mailto:joeante@...] Sent: 22 November 2002 16:23 To: gdalgorithmslist@... Subject: [Algorithms] Quaternion handedness Hi, I am trying to convert tangent space 3x3 matrices for dot3 product bumpmapping to quaternions. I want to convert these 3x3 matrices into quaternions to do the objectspace tangentspace transformation, because I need to slerp my tangentspace transform when doing geomorphing on my chunk lod mesh. The tangentspace orthonormal bases are sometimes right handed, sometimes left handed. Unfortunately my matrix to quaternion algorithm seems not to work on left handed matrices. (I am using the algorithm availible at magicsoftware) Is there any way to represent a lefthanded matrix as a quaternion? What do I have to do to convert my lefthanded orthonormal matrix into a quaternion? Joe Ante 
From: <christer_ericson@pl...>  20021122 19:10:36

>I'm trying to use a bsp tree to determine if a point is inside a volume >whose surface is a two dimensional closed manifold. Due to numerical >accuracy problems the test sometimes incorrectly reports that the point is >inside the volume even when it isn't. > >Does anyone have a robust solution for this that doesn't involve switching >to exact arithmetics? I would also be interested in alternative algorithms >that doesn't involve bsp trees. One possibility I've considered would be to >shoot an infinite ray from the point in an arbitrary direction and check the >orientation of the first polygon it intersects. Unfortunately I think this >solution is too slow to be useful. I think you need to elaborate more on what exactly you're seeing and what exactly you're expecting in order to get good advice. I.e. how incorrect is the result you see now, and just how exact must your answer be. Unless you switch to exact arithmetic you will always get some small number of incorrectly categorized points. One option is to use a tolerance value to guarantee that inclusion is always reported correctly (but which may include points just outside your volume). You're not providing enough information for us to tell whether this is a workable solution. Pointinclusion is a predicate test, so it can fairly easily be computed exactly. You have a few options: 1. Use integers only, making sure you don't overflow. You can remove any divisions by multiplying through by the denominator in the expressions involving divisions. 2. If you need floatingpoint, you can use the exact predicates of Jonathan Shewchuk to do the sidedness test of your BSPtree planes. However, if you've computed the BSPtree, you will already have inaccuracies in this tree, unless you're representing the planes exactly, so you might want to go for a tolerancebased solution. You really need to provide more information though if you expect anyone to help you. Christer Ericson Sony Computer Entertainment, Santa Monica 
From: Tyson Jensen <twjensen@sa...>  20021122 18:41:04

Huh? We wrote an entire game in lefthanded coordinates and we never noticed any "magic" preference for righthandedness in matrices. I am unclear as to why arithmetic would care what hand humans tend to prefer. What happens is that care must be taken when copying algorithms out of books that might be making handedness assumptions. I'd bet money that lhA * lhB = right handed space is a result of a bias in code, not in the math. If you have a lefthanded world and use lefthanded transforms your stuff will remain lefthanded. I recommend a constant matrix that can be applied to convert a matrix from lefthanded to righthanded and another one that goes in reverse. I'd recommend doing all your quaternion stuff in (pick a hand) space. If a matrix is (otherhanded) then convert the matrix to the (correcthanded) space, convert to quaternion, do whatever, convert back, and then convert the (correcthanded) matrix back into an (otherhanded) matrix. Trying to maintain lefthanded quaternions and righthanded quaternions is just compounding the problem of having both lefthanded coordinate spaces and right handed coordinate spaces. Original Message From: gdalgorithmslistadmin@... [mailto:gdalgorithmslistadmin@...] On Behalf Of Joseph, William Sent: Friday, November 22, 2002 9:55 AM To: 'gdalgorithmslist@...' Subject: RE: [Algorithms] Quaternion handedness If I understand matrix stuff correctly, a rotationonly matrix is always righthanded  even when working in a lefthanded coordinate system. If your rotation matrix is lefthanded, transforming a space by it will cause that space to switch handedness. For example.. object space A is lefthanded and object>world rotation matrix B is lefthanded. Applying B to A will result in the object appearing righthanded in worldspace... I think. To construct the rotation matrix correctly, you have to do it in the correct space. I'm not familiar with tangentspace transforms.. but you may be able to do this by converting the lefthanded basis to righthanded, extracting the rotation, then converting back to lefthanded. I suggest experimenting.. Will Original Message From: Joe Ante [mailto:joeante@...] Sent: 22 November 2002 16:23 To: gdalgorithmslist@... Subject: [Algorithms] Quaternion handedness Hi, I am trying to convert tangent space 3x3 matrices for dot3 product bumpmapping to quaternions. I want to convert these 3x3 matrices into quaternions to do the objectspace tangentspace transformation, because I need to slerp my tangentspace transform when doing geomorphing on my chunk lod mesh. The tangentspace orthonormal bases are sometimes right handed, sometimes left handed. Unfortunately my matrix to quaternion algorithm seems not to work on left handed matrices. (I am using the algorithm availible at magicsoftware) Is there any way to represent a lefthanded matrix as a quaternion? What do I have to do to convert my lefthanded orthonormal matrix into a quaternion? Joe Ante  This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ GDAlgorithmslist mailing list GDAlgorithmslist@... https://lists.sourceforge.net/lists/listinfo/gdalgorithmslist Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=6188  This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ GDAlgorithmslist mailing list GDAlgorithmslist@... https://lists.sourceforge.net/lists/listinfo/gdalgorithmslist Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=6188 
From: <castanyo@ya...>  20021122 18:14:39

Rowan Wyborn wrote: > anyways, am i missing something really obvious here? is it really that hard > to handle semitransparent objects in a full scene shadowing algorithm? i'd > really aprreciate hearing how other people are handling this ;) Have you figured out how are you going to light transparent surfaces? You cannot just add light contributions as if the surface were opaque. The only solution i found was to apply the lighting in a single pass, so I just used vertex lighting for them. My transparent surfaces were transparent enough to look ok without shadowing. Other solution is to have 'fluorescent' transparent surfaces. That is, surfaces that emit light, so don't recieve shadows. Hope that helps, Ignacio Castaño castanyo@... _______________________________________________________________ Yahoo! Messenger Nueva versión: Webcam, voz, y mucho más ¡Gratis! Descárgalo ya desde http://messenger.yahoo.es 
From: Joseph, William <WJ<oseph@eu...>  20021122 17:55:24

If I understand matrix stuff correctly, a rotationonly matrix is always righthanded  even when working in a lefthanded coordinate system. If your rotation matrix is lefthanded, transforming a space by it will cause that space to switch handedness. For example.. object space A is lefthanded and object>world rotation matrix B is lefthanded. Applying B to A will result in the object appearing righthanded in worldspace... I think. To construct the rotation matrix correctly, you have to do it in the correct space. I'm not familiar with tangentspace transforms.. but you may be able to do this by converting the lefthanded basis to righthanded, extracting the rotation, then converting back to lefthanded. I suggest experimenting.. Will Original Message From: Joe Ante [mailto:joeante@...] Sent: 22 November 2002 16:23 To: gdalgorithmslist@... Subject: [Algorithms] Quaternion handedness Hi, I am trying to convert tangent space 3x3 matrices for dot3 product bumpmapping to quaternions. I want to convert these 3x3 matrices into quaternions to do the objectspace tangentspace transformation, because I need to slerp my tangentspace transform when doing geomorphing on my chunk lod mesh. The tangentspace orthonormal bases are sometimes right handed, sometimes left handed. Unfortunately my matrix to quaternion algorithm seems not to work on left handed matrices. (I am using the algorithm availible at magicsoftware) Is there any way to represent a lefthanded matrix as a quaternion? What do I have to do to convert my lefthanded orthonormal matrix into a quaternion? Joe Ante  This sf.net email is sponsored by:ThinkGeek Welcome to geek heaven. http://thinkgeek.com/sf _______________________________________________ GDAlgorithmslist mailing list GDAlgorithmslist@... https://lists.sourceforge.net/lists/listinfo/gdalgorithmslist Archives: http://sourceforge.net/mailarchive/forum.php?forum_id=6188 
From: Brinck, Andreas <Andreas.B<rinck@di...>  20021122 17:46:28

I'm trying to use a bsp tree to determine if a point is inside a volume whose surface is a two dimensional closed manifold. Due to numerical accuracy problems the test sometimes incorrectly reports that the point is inside the volume even when it isn't. Does anyone have a robust solution for this that doesn't involve switching to exact arithmetics? I would also be interested in alternative algorithms that doesn't involve bsp trees. One possibility I've considered would be to shoot an infinite ray from the point in an arbitrary direction and check the orientation of the first polygon it intersects. Unfortunately I think this solution is too slow to be useful. /A.B. 
From: Joe Ante <joeante@li...>  20021122 16:23:36

Hi, I am trying to convert tangent space 3x3 matrices for dot3 product bumpmapping to quaternions. I want to convert these 3x3 matrices into quaternions to do the objectspace tangentspace transformation, because I need to slerp my tangentspace transform when doing geomorphing on my chunk lod mesh. The tangentspace orthonormal bases are sometimes right handed, sometimes left handed. Unfortunately my matrix to quaternion algorithm seems not to work on left handed matrices. (I am using the algorithm availible at magicsoftware) Is there any way to represent a lefthanded matrix as a quaternion? What do I have to do to convert my lefthanded orthonormal matrix into a quaternion? Joe Ante 
From: Tamas Schlagl <Tamas.S<chlagl@cl...>  20021122 09:02:56

Hi! > Have you run into any problems with the cases that degenerate into a > traditional shadow map? Yes, when the camera looks at light, like every shadow map algo. > What resolution perspective shadow map are you using here? In the movie I use 1024x1024, when we made 1152x864 screenshots I use 2048x2048. > Also, how much didyou have to play with your near clip plane to get them to > work? Has this been a huge problem? A lot of time "wasted" on playing with near clip plane & offset in pp space... > I noticed you don't have any selfshadowing on the cars. Is this the >precision problem? Thanks. Tom No, this is based on my playing  tuning my shadow map parameters. Finaly I have a good precision  resolution rate, but this needed horrible time.... bye, fanthomas 
From: John Pollard <dawn.pollard@at...>  20021122 08:15:29

MessageHmm, if you must do darkening stencil shadows, and you don't want = them to go through walls, maybe you could do a fourpass scheme, where = you render two types of shadow volumes.=20 First, clear stencil to 128 or something. Then render the shadowvolumes = to the stencil buffer. At this point, the stencil buffer will contain = values where you should darken the screen. Draw a full screen invisible = quad that sets this shadow region to a certain value other than 128, say = 129. At this point, you have values of 128, and 129 in the stencil = buffer. 129 is currently where the screen should be shadowed. Now, for = all the polygons that you want the shadow volume to be blocked by, = extrude those (call them antishadowvolumes) and render the = antishadowvolumes into the stencil buffer. They will invalidate the = parts of the screen that are blocked by the antishadowvolumes. = Finally, draw another fullscreen quad, and darken areas that remain 129 = in the stencil buffer. Would this work? Sounds like alot of passes, but it would allow you to = keep an old school renderpipe, and use the darken stencil shadow volume = method, and still allow geometry to block the shadows. Your probably = going to still see funny anomalies though, if your not careful about = choosing the antishadowvolumes. You'd want to make sure that the = blocking object in question truly blocked the entire shadow, or the = shadow will have "holes" in it. John  Original Message =20 From: Joris Mans=20 To: gdalgorithmslist@...=20 Sent: Thursday, November 21, 2002 7:11 PM Subject: RE: [Algorithms] Stopping shadow volumes from going through = geometry this is what i mean, in "reallife" this is not possible. Usually the = static geom uses some prebaked form of shadowing (lightmap, vertex = darkening, whatever) and it will clash with the dynamic shadowcaster. We = only want the character to cast shadows on the vicinity using stencil = and leave the rest asis. Ofcourse when your initials are JC and you are = making a game called D III things change a bit ;) Joris Original Message From: gdalgorithmslistadmin@... = [mailto:gdalgorithmslistadmin@...] On Behalf Of John = Pollard Sent: Friday, November 22, 2002 1:31 AM To: gdalgorithmslist@... Subject: Re: [Algorithms] Stopping shadow volumes from going through = geometry Hit reply too fast :O >>You don't even need to make the entire scene cast shadows Actually, the character's shadow will still go through the wall. = But you can simply make the wall cast shadows as well. Since it's = blocking imcoming light, it works. And no double darkening.  Original Message =20 From: John Pollard=20 To: gdalgorithmslist@...=20 Sent: Thursday, November 21, 2002 6:23 PM Subject: Re: [Algorithms] Stopping shadow volumes from going = through geometry You won't get the double darkening if you do all your = shadowvolumes at once at the end, and do the fullscreen quad to darken, = but it still doesn't solve the problem completely, as the ledge will now = go through walls, and it's a never ending process, unless like you said, = the whole scene cast shadows. But this method is such a pain, and you = never really fix all the problems. Our shadowvolumes actually block imcoming light, so the problem = goes away (which is how most people are doing it these days I'm = assuming). The drawback, is you have to interleve your light rendering = code between the shadowvolume rendering. The advantage, is all those = problems go away. You don't even need to make the entire scene cast = shadows. Everything just works.  Original Message =20 From: Joris Mans=20 To: gdalgorithmslist@...=20 Sent: Thursday, November 21, 2002 6:04 PM Subject: RE: [Algorithms] Stopping shadow volumes from going = through geometry this is the answer i see all the time when ppl ask this question = (please dont take this personally), but as we all know this doesnt solve = it, even with the ledge casting a shadow you will get "double shadowing" = under the ledge. So if anyone has a way of solving this which does not require = stencilshadowing the entire scene ;) please reply as i dont know it = either : Joris Original Message From: gdalgorithmslistadmin@... = [mailto:gdalgorithmslistadmin@...] On Behalf Of = Gilles Marion Sent: Thursday, November 21, 2002 10:17 PM To: gdalgorithmslist@... Subject: Re: [Algorithms] Stopping shadow volumes from going = through geometry Hi, I think the ledge should also cast its shadow onto the ground, = no ? If so, it doesn't matter if the shadow volume is extruded past = the ledge. If fillrate is your bottleneck, think about clipping (cpu = intensive), or try setting the far side=20 of the shadow volume nearer from the character. If it's a sunlike light, radiosity of the environment should = make look that=20 correct to your eyes. Gilles.  Original Message =20 From: Fong, Jay=20 To: 'gdalgorithmslist@...'=20 Sent: Thursday, November 21, 2002 9:29 PM Subject: [Algorithms] Stopping shadow volumes from going = through geometry Hello, I was wondering if there is some way to prevent shadows, = generated by the stencil shadow volume technique, from being extruded = through other objects in the scene? e.g. a character standing on an = overhanging ledge above ground casts a shadow on the ledge but also onto = the ground below the ledge. I thought about clipping the extruded shadow polys against = the world geometry but I'm hoping for a more elegant (i.e. simpler) = solution since our world geometry is quite dense. Any solutions or links/pointers to papers related to this = issue would be much appreciated! Thanks, Jay 
From: Tom Spilman <tom@pi...>  20021122 02:04:27

I noticed you don't have any selfshadowing on the cars. Is this the precision problem? Thanks. Tom  Original Message  From: "Tamas Schlagl" <Tamas.Schlagl@...> To: <gdalgorithmslist@...> Sent: Thursday, November 21, 2002 4:04 AM Subject: Re: [Algorithms] Perspective shadow maps problems > Hi! > > Maybe my old psm emails help you! > > I'm playing a lot with psm, and after some "hacking" i made this: > http://www.clevers.com > > bye, fanthomas > > > This came form the author of the paper: > > Hmm, > > I am not a DX expert and I don't know your matrix class, but the following > things seem suspicious to me: > >  just adding 0.5 does not map 1..1 to 0..1. Furthermore, I guess that > emulateViewport already maps to the right range, so you probably don't have > to do anything here. > >  why do you compute MV*P ? Do you use row or column vectors? Usually, > column > vectors are used that are multiplied to the matrices from the right. In that > case, you have to compute P*MV, i.e. it first does the modelview > transformation and then the projection. > >  in postperspective space, parallel lights become point lights. So the > postperspective light is *not* orthogonal! > > Maybe this helped, > > Marc > > > On Friday 23 August 2002 11:47, you wrote: > > Hello! > > > > > > I read your Perspective Shadow Mapping paper, after that I try to use in > > our upcoming game called Steel Of Haste ( you can see screenshots & movie > > at http://www.clevers.com ). > > So I have an working version but I have a one intresting problem and an > > other question, please help me if you can! > > > > The problem description: > > The game use DX8.1 so the ppspace isn't the [1,1]^3 cube, but > > [1,1],[1,1],[0,1] cube. > > Definetly I use one directional light. > > If I do everything like you write down on your website,I have an > > intresting effect: > > When I rotate or move my camera ( the light direction not do > > anything), the shadows start move away ( go from his position, like i move > > the > > light direction ). On the shadow I see something like a perspective > > distorsion from the camera. > > As I think this is because my light postition in postperstective > > space isn't at a right position, but why ? Maybe becouse I do some > > conversion on the lightpos.z ???? > > For a quick & dirty sollution i substract from the cameradirection the > > cameradirection paraler part of light direction, after that the cameradir > > is perpendicular for the light direction, > > and after this the shadow working perfectly, but i have other atrifacts :/ > > Do you know what is the problem ??? I included the source code of the > > matrix generation..... maybe this help a little.... > > > > The question: > > In my application a lot of big objects cast shadow, so i decised i not > > move the camera back until every object (witch make shadow for the > screen ) > > included in the camera space, but use > > 2 shadowmap. Do you implemented the 2 shadowmap sollution ??? How this > > working ??? > > > > > > > > Thank you, > > Tamas Schlagl > > > > > > P.S.: I hope you can read my letter, sorry, my engilsh is very poor. :/ > > > > The source code: > > > > //..........Get the light direction................. > > LightDir.Set( GETVAR(LDir[0]), GETVAR(LDir[1]), GETVAR(LDir[2]) ); > > LightDir.Norm(); > > LightPos = LightDir; // At now, the lightpos must be LightDir > > (becouse the DX can't xchange the shadowmapz < pixelz equation... :( > > > > //........... my actual camera for the scene................ > > Camera_lookAt = CameraC>GetTarget(); > > CameraPos = CameraC>GetPos(); > > CameraDir = Camera_lookAt  CameraPos ; > > CameraDir.Norm(); > > > > // CameraDir = CameraDir  LightDir; // CameraDir = > > CameraID  ( CameraDir paraler part of LightDir ) ??????? WHY ??????? > > CameraDir.Norm(); > > Camera_lookAt = CameraPos + CameraDir; > > > > ///.... setup the shadowmap camera.......... > > CameraCamera.Ident(); > > CameraCamera.SetupViewport( GETVAR( NearPlane ) , GETVAR( FarPlane ), 1, > > GETVAR( Fov ), 0,0,SHADOWMAP_SIZE, SHADOWMAP_SIZE ); // get the > > nearplane & the farplane & use the real fov! > > CameraCamera.SetPos( CameraPos ); > > CameraCamera.SetTarget( Camera_lookAt ); > > CameraCamera.SetUpVector( CameraC>GetUpVector() ); > > Render>EmulateViewport( CameraCamera, 0, NULL ); // generate > > camera matrix & projection matrix > > > > CameraMatrix = Render>GetCameraMatrix(); // get > > the matrixes > > ProjMat = Render>GetProjectionMatrix(); > > CameraMatrix.Concat( &ProjMat ); // > > make the viewmatrix ( MV*P ) > > > > //...................................................................... > > LightPos.Rotate_w0( CameraMatrix ); // > > rotate the lightpos ( x,y,z,0 ) to screenspace ! > > //...................................................................... > > > > > > //...................................................................... > > HACK! We are in DX so not [1,1] cube ! z = [0,1] !!! > > LightPos.z += 0.5f; > > Light_lookAt = cVector( 0,0,0.5 ); > > //...................................................................... > > > > //.................................. SM camera........................ > > LightCamera.Ident(); > > LightCamera.SetupViewport( GETVAR( LightNear ), GETVAR( LightFar ), 1, 0, > > 0,0,SHADOWMAP_SIZE,SHADOWMAP_SIZE ); > > LightCamera.SetOrtho( true ); // ORTHOGONAL VIEW!!! > > LightCamera.SetPos( LightPos ); > > LightCamera.SetTarget( Light_lookAt ); > > LightCamera.SetUpVector( cVector(0,0,1) ); // Z is the up vector! > > Render>EmulateViewport( LightCamera, GETVAR( PlaneSize ), NULL ); // > > generate LMV & LP > > > > LightM = Render>GetCameraMatrix(); > > LightProj = Render>GetProjectionMatrix(); > > LightM.Concat( &LightProj ); // create the > > LightMatrix > > > > CameraCamera.SetXpos( 1 ); > > CameraCamera.SetYpos( 1 ); > > CameraCamera.SetWidht( SHADOWMAP_SIZE  2 ); > > CameraCamera.SetHeight( SHADOWMAP_SIZE  2 ); > > Render>SetViewport( CameraCamera, 0, &LightM ); // Use the > CCamera > > for the rendering to the shadowmap BUT the PROJECTION MATRIX MULTIPLIDE > > WITH THE LIGHTMATRIX! > > > > LightMatrix = Render>GetCameraMatrix(); > > LightProj = Render>GetProjectionMatrix(); > > LightMatrix.Concat( &LightProj ); // > THIS > > IS THE matrix what we use as TextureMatrix when we want to use the > > shadowmap! > > > > // LightMatrix contain: MV*P*MVL*PL > >  > EMail: Marc.Stamminger@... > phone: +49 3643 583733 (fax: 3709) > > > > > This from Ulrich: > > On Aug 23, 2002 at 03:31 +0200, Tamas Schlagl wrote: > > > > The problem description: > > The game use DX8.1 so the ppspace isn't the [1,1]^3 cube, but > > [1,1],[1,1],[0,1] cube. > > Definetly I use one directional light. > > If I do everything like you write down on your website,I have an > > intresting effect: > > When I rotate or move my camera ( the light direction not do > > anything), the shadows start move away ( go from his position, like i > move > > the > > light direction ). On the shadow I see something like a perspective > > distorsion from the camera. > > As I think this is because my light postition in postperstective > > space > > isn't at a right position, but why ? Maybe becouse I do some conversion > > on the lightpos.z ???? > > See note below... > > > The question: > > In my application a lot of big objects cast shadow, so i decised i not > > move the camera back until every object (witch make shadow for the > screen ) > > included in the camera space, but use > > 2 shadowmap. Do you implemented the 2 shadowmap sollution ??? Do you > know > > how this > > working ??? > > I haven't thought about that really... does it work well? > > > //...................................................................... > > HACK! We are in DX so not [1,1] cube ! z = [0,1] !!! > > .............................. > > LightPos.z += 0.5f; > > I'm pretty sure you want this instead: > > LightPos.z = (LightPos.z + 1.0f) * 0.5f; > > It's hard to say, though  matrix math always confuses me, and to be > honest I'm a little rusty since I haven't worked on this in a while... > >  > Thatcher Ulrich > http://tulrich.com > > > And some other: > > Thanks for visiting my website. > > I'm very grad for receiving your mail. > My english is very poor too. > so, I can't explain all of my website in english. > > Please, look my documentation for the light matrix > to make the perspective shadow map. > > Waiting for your cool game! > Thanks. > > IMAGIRE Takashi > >   >  > The light matrix of p.s.m. is decomposed into the following element. > > m=[View][Projection][Post Space Scaling][Post View Inverse][Light > View][Light Projection][Offset] > > View: > View matrix is to move to the position of a camera. > > 0269: D3DXVECTOR4 eye = > D3DXVECTOR4(0.0f,1.4f*MeshRadius,2.5f*MeshRadius,1); > 0270: D3DXMatrixLookAtLH(&mView, (D3DXVECTOR3*)&eye > 0271: , &D3DXVECTOR3(0,0,0) > 0272: , &D3DXVECTOR3(0,1,0)); > > Projection: > Projection matrix is to carry out perspective transformation. > With this matrix, you can control the field of view. > Because this field of view of perspective has nothig to do with the one of > camera. > You can control the field of view appropriately according to the resolution > of shadow map. > > 0289: q = 1.0f/(z_maxz_min); > 0292: mProjMap = D3DXMATRIX(1,0,0,0, > 0293: 0,1,0,0, > 0294: 0,0,q,1, > 0295: 0,0,q*z_min,0) * mScale; > > Post Space Scaling: > This matrix scales the post perspective space > to made the close to the world space dimension measurements. > This projection matrix will map the z coordinates, z_min ... z_max > in the view space to 0 ... 1. > Since the range is narrow, matrix converts the coordinate to the one which > is easy to use. > I adjust te parameters to make the unit vector located at the origin > in the original world space have the almost same magnitude after > transformed. > > 0290: float d = D3DXVec3Length((D3DXVECTOR3*)&eye); > 0291: D3DXMatrixScaling(&mScale, d, d, 10000.0f*d*d); > > Post View Inverse: > The matrix is the transformation from the post perspective space to the > world space. > To get this matrix, you can use the same way to get a view matrix. > Like the view matrix tranforms from the world space to the camera space, > you can think of the positon & direction in the post perspective space > as the after transformed space > (in the case of view matrix, this would be the camera space), > and D3DXMatrixLookAtLH, the origin in post perspective space > will be transformed to the origin in the space after projecting. > > 0299: D3DXVECTOR4 cent = D3DXVECTOR4(0,0,0,1); > 0300: D3DXVECTOR4 zdir = D3DXVECTOR4(0,0,1,1); > 0301: D3DXVECTOR4 udir = D3DXVECTOR4(0,1,0,1); > 0302: D3DXVec4Transform(¢, ¢, &mVPm); D3DXVec4Scale(¢, > ¢, 1.0f/cent.w); > 0303: D3DXVec4Transform(&zdir, &zdir, &mVPm); D3DXVec4Scale(&zdir, > &zdir, 1.0f/zdir.w); > 0304: D3DXVec4Transform(&udir, &udir, &mVPm); D3DXVec4Scale(&udir, > &udir, 1.0f/udir.w); > 0305: D3DXMatrixLookAtLH(&mViewI, (D3DXVECTOR3*)¢, > (D3DXVECTOR3*)&zdir, (D3DXVECTOR3*)&udir); > 0308: D3DXMatrixScaling(&mSign,1, 1, 1); > ****: mViewI = mViewI * mSign; > > > Light View: > It is the ordinary view matrix where the light is used as camera. > > 0312: const float zoom =30.f; > 0313: D3DXVECTOR4 eyeP; > 0314: D3DXVec3Transform(&eyeP, &D3DXVECTOR3(zoom*lightDir.x, > zoom*lightDir.y, zoom*lightDir.z), &mVPI); > 0315: D3DXVec4Scale(&eyeP, &eyeP, 1.0f/eyeP.w); > 0316: D3DXMatrixLookAtLH(&mLightView, (D3DXVECTOR3*)&eyeP, > &D3DXVECTOR3(0,0,0), &D3DXVECTOR3(0,1,0)); > > Light Projection: > It is the ordinary projection matrix where the light is used as camera. > This matrix can adjust the resoluton of the screen reflected to a shadow > map. > > 0319: const float lz_min = 20.0f; > 0320: const float lz_max = 300.0f; > 0321: D3DXMatrixPerspectiveFovLH(&mProjL > 0322: ,60.0f*PI/180.0f > 0323: ,1 > 0324: ,lz_min, lz_max > 0325: ); > > Offset: > It shifts the origin of screen to adjust the domain of screen coordinate. > p.s.m. does not use the domain that is far from the camera, > and to use the texture effectively, this shifts the center of texture. > > 0328: D3DXMatrixTranslation(&mShift, 0.5f, 0.5f, 0); > 0329: mLP =mVPI * mLightView * mProjL * mShift; > > > > >  other  > > Looks fantastic ! > Could you outline what do you mean by "in own style" please ? It really > motivates me , could you reveal some specs (shadow map res, visible range of > scene its applied > onto etc.) ? > > Thank you for your time > > Petr S. > >  Puvodni zprava  > Od: "Tamas Schlagl" <Tamas.Schlagl@...> > Odpovedet: "Tamas Schlagl" <Tamas.Schlagl@...> > Datum: Wed, 25 Sep 2002 08:24:39 +0200 > > >Hello! > > > > > >I'm implemented "in own style", you can see at http://www.clevers.com (screenshots > >& movie ). > >This is a very clever trick for shadow maps, but make some new artifacts... > > > >bye, > >Tamas Schlagl > >Lead Programmer > >Clever's Games Ltd > > > > > > Original Message  > >From: "Petr Smilek" <guru@...> > >To: <gdalgorithmslist@...> > >Sent: Tuesday, September 24, 2002 9:50 PM > >Subject: [Algorithms] Perspective shadow maps > > > > > >> Hi, > >> does anybody successfuly implemented and used > >> perspective shadow maps (except authors) in practice ? > >> Is there some demo showing them in action available ? > >> Thank you in advance. > >> > >> Petr S. > >> > >> > >>  > >> This sf.net email is sponsored by:ThinkGeek > >> Welcome to geek heaven. > >> http://thinkgeek.com/sf > >> _______________________________________________ > >> GDAlgorithmslist mailing list > >> GDAlgorithmslist@... > >> https://lists.sourceforge.net/lists/listinfo/gdalgorithmslist > >> Archives: > >> http://sourceforge.net/mailarchive/forum.php?forum_id=6188 > >> > > > > > > Thanks, I'll keep trying :) > > bye, > Petr S. > >  Puvodni zprava  > Od: "Tamas Schlagl" <Tamas.Schlagl@...> > Odpovedet: "Tamas Schlagl" <Tamas.Schlagl@...> > Datum: Thu, 26 Sep 2002 09:44:56 +0200 > > >Hello, > > > >First of all, some specs: map res: 1024x1024, visible range: 250. > > > >So, I know 4 people, who implented this (psm), but everybody use other > >technics for converting the light position to post perspective space... > this > >means "in own style" :) > >The biggest problem with psm is the faliure of z, based on perspective > >space. To avoid this you must use vertexshaders ( add some "tolerance" > based > >on w ).... > > > > > >bye, > >Tamas Schlagl > > > > Original Message  > >From: "Petr Smilek" <guru@...> > >To: "Tamas Schlagl" <Tamas.Schlagl@...> > >Sent: Wednesday, September 25, 2002 12:43 PM > >Subject: Re: [Algorithms] Perspective shadow maps > > > > > >> Looks fantastic ! > >> Could you outline what do you mean by "in own style" please ? It really > >motivates me , could you reveal some specs (shadow map res, visible range > of > >scene its applied > >> onto etc.) ? > >> > >> Thank you for your time > >> > >> Petr S. > > > > > > > > > > > >  > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > GDAlgorithmslist mailing list > GDAlgorithmslist@... > https://lists.sourceforge.net/lists/listinfo/gdalgorithmslist > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=6188 > 
From: Rowan Wyborn <rowan@ir...>  20021122 01:40:31

howdy, soooo i've been wracking my brain trying to figure out an algorithm for casting stencil shadows on semitransparent objects. The most efficient thing i could come up with was to draw and shadow the entire solid scene first, and then go back and draw each semitransparent object back to front in its own 'mini' shadow pass, where for each object i have to rerender any shadow volumes that affect it. This is obviously gonna introduce a bucketload of scene processing overhead, not to mention chew up fillrate.... so i really don't think its feasible. The only other thing i could come up with was to just not cast shadows on semitransparent objects... which i guess could look okayish as long as the objects weren't tooo opaque. anyways, am i missing something really obvious here? is it really that hard to handle semitransparent objects in a full scene shadowing algorithm? i'd really aprreciate hearing how other people are handling this ;) thanks, rowan 
From: Joris Mans <joris.mans@pa...>  20021122 01:11:52

this is what i mean, in "reallife" this is not possible. Usually the static geom uses some prebaked form of shadowing (lightmap, vertex darkening, whatever) and it will clash with the dynamic shadowcaster. We only want the character to cast shadows on the vicinity using stencil and leave the rest asis. Ofcourse when your initials are JC and you are making a game called D III things change a bit ;) Joris Original Message From: gdalgorithmslistadmin@... [mailto:gdalgorithmslistadmin@...] On Behalf Of John Pollard Sent: Friday, November 22, 2002 1:31 AM To: gdalgorithmslist@... Subject: Re: [Algorithms] Stopping shadow volumes from going through geometry Hit reply too fast :O >>You don't even need to make the entire scene cast shadows Actually, the character's shadow will still go through the wall. But you can simply make the wall cast shadows as well. Since it's blocking imcoming light, it works. And no double darkening.  Original Message  From: John <mailto:johnp@...> Pollard To: gdalgorithmslist@... Sent: Thursday, November 21, 2002 6:23 PM Subject: Re: [Algorithms] Stopping shadow volumes from going through geometry You won't get the double darkening if you do all your shadowvolumes at once at the end, and do the fullscreen quad to darken, but it still doesn't solve the problem completely, as the ledge will now go through walls, and it's a never ending process, unless like you said, the whole scene cast shadows. But this method is such a pain, and you never really fix all the problems. Our shadowvolumes actually block imcoming light, so the problem goes away (which is how most people are doing it these days I'm assuming). The drawback, is you have to interleve your light rendering code between the shadowvolume rendering. The advantage, is all those problems go away. You don't even need to make the entire scene cast shadows. Everything just works.  Original Message  From: Joris <mailto:joris.mans@...> Mans To: gdalgorithmslist@... Sent: Thursday, November 21, 2002 6:04 PM Subject: RE: [Algorithms] Stopping shadow volumes from going through geometry this is the answer i see all the time when ppl ask this question (please dont take this personally), but as we all know this doesnt solve it, even with the ledge casting a shadow you will get "double shadowing" under the ledge. So if anyone has a way of solving this which does not require stencilshadowing the entire scene ;) please reply as i dont know it either : Joris Original Message From: gdalgorithmslistadmin@... [mailto:gdalgorithmslistadmin@...] On Behalf Of Gilles Marion Sent: Thursday, November 21, 2002 10:17 PM To: gdalgorithmslist@... Subject: Re: [Algorithms] Stopping shadow volumes from going through geometry Hi, I think the ledge should also cast its shadow onto the ground, no ? If so, it doesn't matter if the shadow volume is extruded past the ledge. If fillrate is your bottleneck, think about clipping (cpu intensive), or try setting the far side of the shadow volume nearer from the character. If it's a sunlike light, radiosity of the environment should make look that correct to your eyes. Gilles.  Original Message  From: Fong, <mailto:JFong@...> Jay To: 'gdalgorithmslist@...' Sent: Thursday, November 21, 2002 9:29 PM Subject: [Algorithms] Stopping shadow volumes from going through geometry Hello, I was wondering if there is some way to prevent shadows, generated by the stencil shadow volume technique, from being extruded through other objects in the scene? e.g. a character standing on an overhanging ledge above ground casts a shadow on the ledge but also onto the ground below the ledge. I thought about clipping the extruded shadow polys against the world geometry but I'm hoping for a more elegant (i.e. simpler) solution since our world geometry is quite dense. Any solutions or links/pointers to papers related to this issue would be much appreciated! Thanks, Jay 
From: John Pollard <johnp@3d...>  20021122 00:34:12

MessageHit reply too fast :O >>You don't even need to make the entire scene cast shadows Actually, the character's shadow will still go through the wall. But = you can simply make the wall cast shadows as well. Since it's blocking = imcoming light, it works. And no double darkening.  Original Message =20 From: John Pollard=20 To: gdalgorithmslist@...=20 Sent: Thursday, November 21, 2002 6:23 PM Subject: Re: [Algorithms] Stopping shadow volumes from going through = geometry You won't get the double darkening if you do all your shadowvolumes at = once at the end, and do the fullscreen quad to darken, but it still = doesn't solve the problem completely, as the ledge will now go through = walls, and it's a never ending process, unless like you said, the whole = scene cast shadows. But this method is such a pain, and you never = really fix all the problems. Our shadowvolumes actually block imcoming light, so the problem goes = away (which is how most people are doing it these days I'm assuming). = The drawback, is you have to interleve your light rendering code between = the shadowvolume rendering. The advantage, is all those problems go = away. You don't even need to make the entire scene cast shadows. = Everything just works.  Original Message =20 From: Joris Mans=20 To: gdalgorithmslist@...=20 Sent: Thursday, November 21, 2002 6:04 PM Subject: RE: [Algorithms] Stopping shadow volumes from going through = geometry this is the answer i see all the time when ppl ask this question = (please dont take this personally), but as we all know this doesnt solve = it, even with the ledge casting a shadow you will get "double shadowing" = under the ledge. So if anyone has a way of solving this which does not require = stencilshadowing the entire scene ;) please reply as i dont know it = either : Joris Original Message From: gdalgorithmslistadmin@... = [mailto:gdalgorithmslistadmin@...] On Behalf Of = Gilles Marion Sent: Thursday, November 21, 2002 10:17 PM To: gdalgorithmslist@... Subject: Re: [Algorithms] Stopping shadow volumes from going = through geometry Hi, I think the ledge should also cast its shadow onto the ground, no = ? If so, it doesn't matter if the shadow volume is extruded past the = ledge. If fillrate is your bottleneck, think about clipping (cpu = intensive), or try setting the far side=20 of the shadow volume nearer from the character. If it's a sunlike light, radiosity of the environment should make = look that=20 correct to your eyes. Gilles.  Original Message =20 From: Fong, Jay=20 To: 'gdalgorithmslist@...'=20 Sent: Thursday, November 21, 2002 9:29 PM Subject: [Algorithms] Stopping shadow volumes from going through = geometry Hello, I was wondering if there is some way to prevent shadows, = generated by the stencil shadow volume technique, from being extruded = through other objects in the scene? e.g. a character standing on an = overhanging ledge above ground casts a shadow on the ledge but also onto = the ground below the ledge. I thought about clipping the extruded shadow polys against the = world geometry but I'm hoping for a more elegant (i.e. simpler) solution = since our world geometry is quite dense. Any solutions or links/pointers to papers related to this issue = would be much appreciated! Thanks, Jay 
From: John Pollard <johnp@3d...>  20021122 00:26:37

MessageYou won't get the double darkening if you do all your = shadowvolumes at once at the end, and do the fullscreen quad to darken, = but it still doesn't solve the problem completely, as the ledge will now = go through walls, and it's a never ending process, unless like you said, = the whole scene cast shadows. But this method is such a pain, and you = never really fix all the problems. Our shadowvolumes actually block imcoming light, so the problem goes = away (which is how most people are doing it these days I'm assuming). = The drawback, is you have to interleve your light rendering code between = the shadowvolume rendering. The advantage, is all those problems go = away. You don't even need to make the entire scene cast shadows. = Everything just works.  Original Message =20 From: Joris Mans=20 To: gdalgorithmslist@...=20 Sent: Thursday, November 21, 2002 6:04 PM Subject: RE: [Algorithms] Stopping shadow volumes from going through = geometry this is the answer i see all the time when ppl ask this question = (please dont take this personally), but as we all know this doesnt solve = it, even with the ledge casting a shadow you will get "double shadowing" = under the ledge. So if anyone has a way of solving this which does not require = stencilshadowing the entire scene ;) please reply as i dont know it = either : Joris Original Message From: gdalgorithmslistadmin@... = [mailto:gdalgorithmslistadmin@...] On Behalf Of = Gilles Marion Sent: Thursday, November 21, 2002 10:17 PM To: gdalgorithmslist@... Subject: Re: [Algorithms] Stopping shadow volumes from going through = geometry Hi, I think the ledge should also cast its shadow onto the ground, no ? If so, it doesn't matter if the shadow volume is extruded past the = ledge. If fillrate is your bottleneck, think about clipping (cpu = intensive), or try setting the far side=20 of the shadow volume nearer from the character. If it's a sunlike light, radiosity of the environment should make = look that=20 correct to your eyes. Gilles.  Original Message =20 From: Fong, Jay=20 To: 'gdalgorithmslist@...'=20 Sent: Thursday, November 21, 2002 9:29 PM Subject: [Algorithms] Stopping shadow volumes from going through = geometry Hello, I was wondering if there is some way to prevent shadows, generated = by the stencil shadow volume technique, from being extruded through = other objects in the scene? e.g. a character standing on an overhanging = ledge above ground casts a shadow on the ledge but also onto the ground = below the ledge. I thought about clipping the extruded shadow polys against the = world geometry but I'm hoping for a more elegant (i.e. simpler) solution = since our world geometry is quite dense. Any solutions or links/pointers to papers related to this issue = would be much appreciated! Thanks, Jay 
From: Joris Mans <joris.mans@pa...>  20021122 00:04:14

this is the answer i see all the time when ppl ask this question (please dont take this personally), but as we all know this doesnt solve it, even with the ledge casting a shadow you will get "double shadowing" under the ledge. So if anyone has a way of solving this which does not require stencilshadowing the entire scene ;) please reply as i dont know it either : Joris Original Message From: gdalgorithmslistadmin@... [mailto:gdalgorithmslistadmin@...] On Behalf Of Gilles Marion Sent: Thursday, November 21, 2002 10:17 PM To: gdalgorithmslist@... Subject: Re: [Algorithms] Stopping shadow volumes from going through geometry Hi, I think the ledge should also cast its shadow onto the ground, no ? If so, it doesn't matter if the shadow volume is extruded past the ledge. If fillrate is your bottleneck, think about clipping (cpu intensive), or try setting the far side of the shadow volume nearer from the character. If it's a sunlike light, radiosity of the environment should make look that correct to your eyes. Gilles.  Original Message  From: Fong, Jay <mailto:JFong@...> To: 'gdalgorithmslist@...' Sent: Thursday, November 21, 2002 9:29 PM Subject: [Algorithms] Stopping shadow volumes from going through geometry Hello, I was wondering if there is some way to prevent shadows, generated by the stencil shadow volume technique, from being extruded through other objects in the scene? e.g. a character standing on an overhanging ledge above ground casts a shadow on the ledge but also onto the ground below the ledge. I thought about clipping the extruded shadow polys against the world geometry but I'm hoping for a more elegant (i.e. simpler) solution since our world geometry is quite dense. Any solutions or links/pointers to papers related to this issue would be much appreciated! Thanks, Jay 
From: Gilles Marion <gilles.marion@fr...>  20021121 21:12:48

MessageHi, I think the ledge should also cast its shadow onto the ground, no ? If so, it doesn't matter if the shadow volume is extruded past the = ledge. If fillrate is your bottleneck, think about clipping (cpu intensive), or = try setting the far side=20 of the shadow volume nearer from the character. If it's a sunlike light, radiosity of the environment should make look = that=20 correct to your eyes. Gilles.  Original Message =20 From: Fong, Jay=20 To: 'gdalgorithmslist@...'=20 Sent: Thursday, November 21, 2002 9:29 PM Subject: [Algorithms] Stopping shadow volumes from going through = geometry Hello, I was wondering if there is some way to prevent shadows, generated by = the stencil shadow volume technique, from being extruded through other = objects in the scene? e.g. a character standing on an overhanging ledge = above ground casts a shadow on the ledge but also onto the ground below = the ledge. I thought about clipping the extruded shadow polys against the world = geometry but I'm hoping for a more elegant (i.e. simpler) solution since = our world geometry is quite dense. Any solutions or links/pointers to papers related to this issue would = be much appreciated! Thanks, Jay 
From: Fong, Jay <JFong@Blackisle.com>  20021121 20:31:20

Hello, I was wondering if there is some way to prevent shadows, generated by the stencil shadow volume technique, from being extruded through other objects in the scene? e.g. a character standing on an overhanging ledge above ground casts a shadow on the ledge but also onto the ground below the ledge. I thought about clipping the extruded shadow polys against the world geometry but I'm hoping for a more elegant (i.e. simpler) solution since our world geometry is quite dense. Any solutions or links/pointers to papers related to this issue would be much appreciated! Thanks, Jay 
From: Gary McTaggart <gary@va...>  20021121 17:42:49

Also, how much didyou have to play with your near clip plane to get them to work? Has this been a huge problem? Thanks again, Gary > Original Message > From: Tamas Schlagl [mailto:Tamas.Schlagl@...] > Sent: Thursday, November 21, 2002 2:04 AM > To: gdalgorithmslist@... > Subject: Re: [Algorithms] Perspective shadow maps problems > > > Hi! > > Maybe my old psm emails help you! > > I'm playing a lot with psm, and after some "hacking" i made this: > http://www.clevers.com > > bye, fanthomas > > > This came form the author of the paper: > > Hmm, > > I am not a DX expert and I don't know your matrix class, but > the following > things seem suspicious to me: > >  just adding 0.5 does not map 1..1 to 0..1. Furthermore, I > guess that > emulateViewport already maps to the right range, so you > probably don't have > to do anything here. > >  why do you compute MV*P ? Do you use row or column vectors? Usually, > column > vectors are used that are multiplied to the matrices from the > right. In that > case, you have to compute P*MV, i.e. it first does the modelview > transformation and then the projection. > >  in postperspective space, parallel lights become point > lights. So the > postperspective light is *not* orthogonal! > > Maybe this helped, > > Marc > > > On Friday 23 August 2002 11:47, you wrote: > > Hello! > > > > > > I read your Perspective Shadow Mapping paper, after that I > try to use in > > our upcoming game called Steel Of Haste ( you can see > screenshots & movie > > at http://www.clevers.com ). > > So I have an working version but I have a one intresting > problem and an > > other question, please help me if you can! > > > > The problem description: > > The game use DX8.1 so the ppspace isn't the [1,1]^3 cube, but > > [1,1],[1,1],[0,1] cube. > > Definetly I use one directional light. > > If I do everything like you write down on your website,I have an > > intresting effect: > > When I rotate or move my camera ( the light direction not do > > anything), the shadows start move away ( go from his > position, like i move > > the > > light direction ). On the shadow I see something like a > perspective > > distorsion from the camera. > > As I think this is because my light postition in > postperstective > > space isn't at a right position, but why ? Maybe becouse I do some > > conversion on the lightpos.z ???? > > For a quick & dirty sollution i substract from the > cameradirection the > > cameradirection paraler part of light direction, after that > the cameradir > > is perpendicular for the light direction, > > and after this the shadow working perfectly, but i have > other atrifacts :/ > > Do you know what is the problem ??? I included the > source code of the > > matrix generation..... maybe this help a little.... > > > > The question: > > In my application a lot of big objects cast shadow, so i > decised i not > > move the camera back until every object (witch make shadow for the > screen ) > > included in the camera space, but use > > 2 shadowmap. Do you implemented the 2 shadowmap sollution > ??? How this > > working ??? > > > > > > > > Thank you, > > Tamas Schlagl > > > > > > P.S.: I hope you can read my letter, sorry, my engilsh is > very poor. :/ > > > > The source code: > > > > //..........Get the light direction................. > > LightDir.Set( GETVAR(LDir[0]), GETVAR(LDir[1]), GETVAR(LDir[2]) ); > > LightDir.Norm(); > > LightPos = LightDir; // At now, the lightpos must > be LightDir > > (becouse the DX can't xchange the shadowmapz < pixelz > equation... :( > > > > //........... my actual camera for the scene................ > > Camera_lookAt = CameraC>GetTarget(); > > CameraPos = CameraC>GetPos(); > > CameraDir = Camera_lookAt  CameraPos ; > > CameraDir.Norm(); > > > > // CameraDir = CameraDir  LightDir; > // CameraDir = > > CameraID  ( CameraDir paraler part of LightDir ) ??????? > WHY ??????? > > CameraDir.Norm(); > > Camera_lookAt = CameraPos + CameraDir; > > > > ///.... setup the shadowmap camera.......... > > CameraCamera.Ident(); > > CameraCamera.SetupViewport( GETVAR( NearPlane ) , GETVAR( > FarPlane ), 1, > > GETVAR( Fov ), 0,0,SHADOWMAP_SIZE, SHADOWMAP_SIZE ); // get the > > nearplane & the farplane & use the real fov! > > CameraCamera.SetPos( CameraPos ); > > CameraCamera.SetTarget( Camera_lookAt ); > > CameraCamera.SetUpVector( CameraC>GetUpVector() ); > > Render>EmulateViewport( CameraCamera, 0, NULL ); > // generate > > camera matrix & projection matrix > > > > CameraMatrix = Render>GetCameraMatrix(); > // get > > the matrixes > > ProjMat = Render>GetProjectionMatrix(); > > CameraMatrix.Concat( &ProjMat ); > // > > make the viewmatrix ( MV*P ) > > > > > //............................................................ > .......... > > LightPos.Rotate_w0( CameraMatrix ); > // > > rotate the lightpos ( x,y,z,0 ) to screenspace ! > > > //............................................................ > .......... > > > > > > > //............................................................ > .......... > > HACK! We are in DX so not [1,1] cube ! z = [0,1] !!! > > LightPos.z += 0.5f; > > Light_lookAt = cVector( 0,0,0.5 ); > > > //............................................................ > .......... > > > > //.................................. SM > camera........................ > > LightCamera.Ident(); > > LightCamera.SetupViewport( GETVAR( LightNear ), GETVAR( > LightFar ), 1, 0, > > 0,0,SHADOWMAP_SIZE,SHADOWMAP_SIZE ); > > LightCamera.SetOrtho( true ); // ORTHOGONAL VIEW!!! > > LightCamera.SetPos( LightPos ); > > LightCamera.SetTarget( Light_lookAt ); > > LightCamera.SetUpVector( cVector(0,0,1) ); // Z is > the up vector! > > Render>EmulateViewport( LightCamera, GETVAR( PlaneSize ), > NULL ); // > > generate LMV & LP > > > > LightM = Render>GetCameraMatrix(); > > LightProj = Render>GetProjectionMatrix(); > > LightM.Concat( &LightProj ); // > create the > > LightMatrix > > > > CameraCamera.SetXpos( 1 ); > > CameraCamera.SetYpos( 1 ); > > CameraCamera.SetWidht( SHADOWMAP_SIZE  2 ); > > CameraCamera.SetHeight( SHADOWMAP_SIZE  2 ); > > Render>SetViewport( CameraCamera, 0, &LightM ); // Use the > CCamera > > for the rendering to the shadowmap BUT the PROJECTION > MATRIX MULTIPLIDE > > WITH THE LIGHTMATRIX! > > > > LightMatrix = Render>GetCameraMatrix(); > > LightProj = Render>GetProjectionMatrix(); > > LightMatrix.Concat( &LightProj ); > // > THIS > > IS THE matrix what we use as TextureMatrix when we want to use the > > shadowmap! > > > > // LightMatrix contain: MV*P*MVL*PL > >  > EMail: Marc.Stamminger@... > phone: +49 3643 583733 (fax: 3709) > > > > > This from Ulrich: > > On Aug 23, 2002 at 03:31 +0200, Tamas Schlagl wrote: > > > > The problem description: > > The game use DX8.1 so the ppspace isn't the [1,1]^3 cube, but > > [1,1],[1,1],[0,1] cube. > > Definetly I use one directional light. > > If I do everything like you write down on your > website,I have an > > intresting effect: > > When I rotate or move my camera ( the light direction not do > > anything), the shadows start move away ( go from his > position, like i > move > > the > > light direction ). On the shadow I see something like > a perspective > > distorsion from the camera. > > As I think this is because my light postition in > postperstective > > space > > isn't at a right position, but why ? Maybe becouse I do > some conversion > > on the lightpos.z ???? > > See note below... > > > The question: > > In my application a lot of big objects cast shadow, so > i decised i not > > move the camera back until every object (witch make shadow for the > screen ) > > included in the camera space, but use > > 2 shadowmap. Do you implemented the 2 shadowmap sollution > ??? Do you > know > > how this > > working ??? > > I haven't thought about that really... does it work well? > > > > //............................................................ > .......... > > HACK! We are in DX so not [1,1] cube ! z = [0,1] !!! > > .............................. > > LightPos.z += 0.5f; > > I'm pretty sure you want this instead: > > LightPos.z = (LightPos.z + 1.0f) * 0.5f; > > It's hard to say, though  matrix math always confuses me, and to be > honest I'm a little rusty since I haven't worked on this in a while... > >  > Thatcher Ulrich > http://tulrich.com > > > And some other: > > Thanks for visiting my website. > > I'm very grad for receiving your mail. > My english is very poor too. > so, I can't explain all of my website in english. > > Please, look my documentation for the light matrix > to make the perspective shadow map. > > Waiting for your cool game! > Thanks. > > IMAGIRE Takashi > >  >  >  > The light matrix of p.s.m. is decomposed into the following element. > > m=[View][Projection][Post Space Scaling][Post View Inverse][Light > View][Light Projection][Offset] > > View: > View matrix is to move to the position of a camera. > > 0269: D3DXVECTOR4 eye = > D3DXVECTOR4(0.0f,1.4f*MeshRadius,2.5f*MeshRadius,1); > 0270: D3DXMatrixLookAtLH(&mView, (D3DXVECTOR3*)&eye > 0271: , &D3DXVECTOR3(0,0,0) > 0272: , &D3DXVECTOR3(0,1,0)); > > Projection: > Projection matrix is to carry out perspective transformation. > With this matrix, you can control the field of view. > Because this field of view of perspective has nothig to do > with the one of > camera. > You can control the field of view appropriately according to > the resolution > of shadow map. > > 0289: q = 1.0f/(z_maxz_min); > 0292: mProjMap = D3DXMATRIX(1,0,0,0, > 0293: 0,1,0,0, > 0294: 0,0,q,1, > 0295: 0,0,q*z_min,0) * mScale; > > Post Space Scaling: > This matrix scales the post perspective space > to made the close to the world space dimension measurements. > This projection matrix will map the z coordinates, z_min ... z_max > in the view space to 0 ... 1. > Since the range is narrow, matrix converts the coordinate to > the one which > is easy to use. > I adjust te parameters to make the unit vector located at the origin > in the original world space have the almost same magnitude after > transformed. > > 0290: float d = D3DXVec3Length((D3DXVECTOR3*)&eye); > 0291: D3DXMatrixScaling(&mScale, d, d, 10000.0f*d*d); > > Post View Inverse: > The matrix is the transformation from the post perspective > space to the > world space. > To get this matrix, you can use the same way to get a view matrix. > Like the view matrix tranforms from the world space to the > camera space, > you can think of the positon & direction in the post perspective space > as the after transformed space > (in the case of view matrix, this would be the camera space), > and D3DXMatrixLookAtLH, the origin in post perspective space > will be transformed to the origin in the space after projecting. > > 0299: D3DXVECTOR4 cent = D3DXVECTOR4(0,0,0,1); > 0300: D3DXVECTOR4 zdir = D3DXVECTOR4(0,0,1,1); > 0301: D3DXVECTOR4 udir = D3DXVECTOR4(0,1,0,1); > 0302: D3DXVec4Transform(¢, ¢, &mVPm); D3DXVec4Scale(¢, > ¢, 1.0f/cent.w); > 0303: D3DXVec4Transform(&zdir, &zdir, &mVPm); D3DXVec4Scale(&zdir, > &zdir, 1.0f/zdir.w); > 0304: D3DXVec4Transform(&udir, &udir, &mVPm); D3DXVec4Scale(&udir, > &udir, 1.0f/udir.w); > 0305: D3DXMatrixLookAtLH(&mViewI, (D3DXVECTOR3*)¢, > (D3DXVECTOR3*)&zdir, (D3DXVECTOR3*)&udir); > 0308: D3DXMatrixScaling(&mSign,1, 1, 1); > ****: mViewI = mViewI * mSign; > > > Light View: > It is the ordinary view matrix where the light is used as camera. > > 0312: const float zoom =30.f; > 0313: D3DXVECTOR4 eyeP; > 0314: D3DXVec3Transform(&eyeP, &D3DXVECTOR3(zoom*lightDir.x, > zoom*lightDir.y, zoom*lightDir.z), &mVPI); > 0315: D3DXVec4Scale(&eyeP, &eyeP, 1.0f/eyeP.w); > 0316: D3DXMatrixLookAtLH(&mLightView, (D3DXVECTOR3*)&eyeP, > &D3DXVECTOR3(0,0,0), &D3DXVECTOR3(0,1,0)); > > Light Projection: > It is the ordinary projection matrix where the light is used > as camera. > This matrix can adjust the resoluton of the screen reflected > to a shadow > map. > > 0319: const float lz_min = 20.0f; > 0320: const float lz_max = 300.0f; > 0321: D3DXMatrixPerspectiveFovLH(&mProjL > 0322: ,60.0f*PI/180.0f > 0323: ,1 > 0324: ,lz_min, lz_max > 0325: ); > > Offset: > It shifts the origin of screen to adjust the domain of screen > coordinate. > p.s.m. does not use the domain that is far from the camera, > and to use the texture effectively, this shifts the center of texture. > > 0328: D3DXMatrixTranslation(&mShift, 0.5f, 0.5f, 0); > 0329: mLP =mVPI * mLightView * mProjL * mShift; > > > > >  other  > > Looks fantastic ! > Could you outline what do you mean by "in own style" please ? > It really > motivates me , could you reveal some specs (shadow map res, > visible range of > scene its applied > onto etc.) ? > > Thank you for your time > > Petr S. > >  Puvodni zprava  > Od: "Tamas Schlagl" <Tamas.Schlagl@...> > Odpovedet: "Tamas Schlagl" <Tamas.Schlagl@...> > Datum: Wed, 25 Sep 2002 08:24:39 +0200 > > >Hello! > > > > > >I'm implemented "in own style", you can see at > http://www.clevers.com (screenshots > >& movie ). > >This is a very clever trick for shadow maps, but make some > new artifacts... > > > >bye, > >Tamas Schlagl > >Lead Programmer > >Clever's Games Ltd > > > > > > Original Message  > >From: "Petr Smilek" <guru@...> > >To: <gdalgorithmslist@...> > >Sent: Tuesday, September 24, 2002 9:50 PM > >Subject: [Algorithms] Perspective shadow maps > > > > > >> Hi, > >> does anybody successfuly implemented and used > >> perspective shadow maps (except authors) in practice ? > >> Is there some demo showing them in action available ? > >> Thank you in advance. > >> > >> Petr S. > >> > >> > >>  > >> This sf.net email is sponsored by:ThinkGeek > >> Welcome to geek heaven. > >> http://thinkgeek.com/sf > >> _______________________________________________ > >> GDAlgorithmslist mailing list > >> GDAlgorithmslist@... > >> https://lists.sourceforge.net/lists/listinfo/gdalgorithmslist > >> Archives: > >> http://sourceforge.net/mailarchive/forum.php?forum_id=6188 > >> > > > > > > Thanks, I'll keep trying :) > > bye, > Petr S. > >  Puvodni zprava  > Od: "Tamas Schlagl" <Tamas.Schlagl@...> > Odpovedet: "Tamas Schlagl" <Tamas.Schlagl@...> > Datum: Thu, 26 Sep 2002 09:44:56 +0200 > > >Hello, > > > >First of all, some specs: map res: 1024x1024, visible range: 250. > > > >So, I know 4 people, who implented this (psm), but everybody > use other > >technics for converting the light position to post > perspective space... > this > >means "in own style" :) > >The biggest problem with psm is the faliure of z, based on > perspective > >space. To avoid this you must use vertexshaders ( add some > "tolerance" > based > >on w ).... > > > > > >bye, > >Tamas Schlagl > > > > Original Message  > >From: "Petr Smilek" <guru@...> > >To: "Tamas Schlagl" <Tamas.Schlagl@...> > >Sent: Wednesday, September 25, 2002 12:43 PM > >Subject: Re: [Algorithms] Perspective shadow maps > > > > > >> Looks fantastic ! > >> Could you outline what do you mean by "in own style" > please ? It really > >motivates me , could you reveal some specs (shadow map res, > visible range > of > >scene its applied > >> onto etc.) ? > >> > >> Thank you for your time > >> > >> Petr S. > > > > > > > > > > > >  > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > GDAlgorithmslist mailing list > GDAlgorithmslist@... > https://lists.sourceforge.net/lists/listinfo/gdalgorithmslist > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=6188 > 
From: Gary McTaggart <gary@va...>  20021121 17:39:34

What resolution perspective shadow map are you using here? Thanks, Gary > Original Message > From: Tamas Schlagl [mailto:Tamas.Schlagl@...] > Sent: Thursday, November 21, 2002 2:04 AM > To: gdalgorithmslist@... > Subject: Re: [Algorithms] Perspective shadow maps problems > > > Hi! > > Maybe my old psm emails help you! > > I'm playing a lot with psm, and after some "hacking" i made this: > http://www.clevers.com > > bye, fanthomas > > > This came form the author of the paper: > > Hmm, > > I am not a DX expert and I don't know your matrix class, but > the following > things seem suspicious to me: > >  just adding 0.5 does not map 1..1 to 0..1. Furthermore, I > guess that > emulateViewport already maps to the right range, so you > probably don't have > to do anything here. > >  why do you compute MV*P ? Do you use row or column vectors? Usually, > column > vectors are used that are multiplied to the matrices from the > right. In that > case, you have to compute P*MV, i.e. it first does the modelview > transformation and then the projection. > >  in postperspective space, parallel lights become point > lights. So the > postperspective light is *not* orthogonal! > > Maybe this helped, > > Marc > > > On Friday 23 August 2002 11:47, you wrote: > > Hello! > > > > > > I read your Perspective Shadow Mapping paper, after that I > try to use in > > our upcoming game called Steel Of Haste ( you can see > screenshots & movie > > at http://www.clevers.com ). > > So I have an working version but I have a one intresting > problem and an > > other question, please help me if you can! > > > > The problem description: > > The game use DX8.1 so the ppspace isn't the [1,1]^3 cube, but > > [1,1],[1,1],[0,1] cube. > > Definetly I use one directional light. > > If I do everything like you write down on your website,I have an > > intresting effect: > > When I rotate or move my camera ( the light direction not do > > anything), the shadows start move away ( go from his > position, like i move > > the > > light direction ). On the shadow I see something like a > perspective > > distorsion from the camera. > > As I think this is because my light postition in > postperstective > > space isn't at a right position, but why ? Maybe becouse I do some > > conversion on the lightpos.z ???? > > For a quick & dirty sollution i substract from the > cameradirection the > > cameradirection paraler part of light direction, after that > the cameradir > > is perpendicular for the light direction, > > and after this the shadow working perfectly, but i have > other atrifacts :/ > > Do you know what is the problem ??? I included the > source code of the > > matrix generation..... maybe this help a little.... > > > > The question: > > In my application a lot of big objects cast shadow, so i > decised i not > > move the camera back until every object (witch make shadow for the > screen ) > > included in the camera space, but use > > 2 shadowmap. Do you implemented the 2 shadowmap sollution > ??? How this > > working ??? > > > > > > > > Thank you, > > Tamas Schlagl > > > > > > P.S.: I hope you can read my letter, sorry, my engilsh is > very poor. :/ > > > > The source code: > > > > //..........Get the light direction................. > > LightDir.Set( GETVAR(LDir[0]), GETVAR(LDir[1]), GETVAR(LDir[2]) ); > > LightDir.Norm(); > > LightPos = LightDir; // At now, the lightpos must > be LightDir > > (becouse the DX can't xchange the shadowmapz < pixelz > equation... :( > > > > //........... my actual camera for the scene................ > > Camera_lookAt = CameraC>GetTarget(); > > CameraPos = CameraC>GetPos(); > > CameraDir = Camera_lookAt  CameraPos ; > > CameraDir.Norm(); > > > > // CameraDir = CameraDir  LightDir; > // CameraDir = > > CameraID  ( CameraDir paraler part of LightDir ) ??????? > WHY ??????? > > CameraDir.Norm(); > > Camera_lookAt = CameraPos + CameraDir; > > > > ///.... setup the shadowmap camera.......... > > CameraCamera.Ident(); > > CameraCamera.SetupViewport( GETVAR( NearPlane ) , GETVAR( > FarPlane ), 1, > > GETVAR( Fov ), 0,0,SHADOWMAP_SIZE, SHADOWMAP_SIZE ); // get the > > nearplane & the farplane & use the real fov! > > CameraCamera.SetPos( CameraPos ); > > CameraCamera.SetTarget( Camera_lookAt ); > > CameraCamera.SetUpVector( CameraC>GetUpVector() ); > > Render>EmulateViewport( CameraCamera, 0, NULL ); > // generate > > camera matrix & projection matrix > > > > CameraMatrix = Render>GetCameraMatrix(); > // get > > the matrixes > > ProjMat = Render>GetProjectionMatrix(); > > CameraMatrix.Concat( &ProjMat ); > // > > make the viewmatrix ( MV*P ) > > > > > //............................................................ > .......... > > LightPos.Rotate_w0( CameraMatrix ); > // > > rotate the lightpos ( x,y,z,0 ) to screenspace ! > > > //............................................................ > .......... > > > > > > > //............................................................ > .......... > > HACK! We are in DX so not [1,1] cube ! z = [0,1] !!! > > LightPos.z += 0.5f; > > Light_lookAt = cVector( 0,0,0.5 ); > > > //............................................................ > .......... > > > > //.................................. SM > camera........................ > > LightCamera.Ident(); > > LightCamera.SetupViewport( GETVAR( LightNear ), GETVAR( > LightFar ), 1, 0, > > 0,0,SHADOWMAP_SIZE,SHADOWMAP_SIZE ); > > LightCamera.SetOrtho( true ); // ORTHOGONAL VIEW!!! > > LightCamera.SetPos( LightPos ); > > LightCamera.SetTarget( Light_lookAt ); > > LightCamera.SetUpVector( cVector(0,0,1) ); // Z is > the up vector! > > Render>EmulateViewport( LightCamera, GETVAR( PlaneSize ), > NULL ); // > > generate LMV & LP > > > > LightM = Render>GetCameraMatrix(); > > LightProj = Render>GetProjectionMatrix(); > > LightM.Concat( &LightProj ); // > create the > > LightMatrix > > > > CameraCamera.SetXpos( 1 ); > > CameraCamera.SetYpos( 1 ); > > CameraCamera.SetWidht( SHADOWMAP_SIZE  2 ); > > CameraCamera.SetHeight( SHADOWMAP_SIZE  2 ); > > Render>SetViewport( CameraCamera, 0, &LightM ); // Use the > CCamera > > for the rendering to the shadowmap BUT the PROJECTION > MATRIX MULTIPLIDE > > WITH THE LIGHTMATRIX! > > > > LightMatrix = Render>GetCameraMatrix(); > > LightProj = Render>GetProjectionMatrix(); > > LightMatrix.Concat( &LightProj ); > // > THIS > > IS THE matrix what we use as TextureMatrix when we want to use the > > shadowmap! > > > > // LightMatrix contain: MV*P*MVL*PL > >  > EMail: Marc.Stamminger@... > phone: +49 3643 583733 (fax: 3709) > > > > > This from Ulrich: > > On Aug 23, 2002 at 03:31 +0200, Tamas Schlagl wrote: > > > > The problem description: > > The game use DX8.1 so the ppspace isn't the [1,1]^3 cube, but > > [1,1],[1,1],[0,1] cube. > > Definetly I use one directional light. > > If I do everything like you write down on your > website,I have an > > intresting effect: > > When I rotate or move my camera ( the light direction not do > > anything), the shadows start move away ( go from his > position, like i > move > > the > > light direction ). On the shadow I see something like > a perspective > > distorsion from the camera. > > As I think this is because my light postition in > postperstective > > space > > isn't at a right position, but why ? Maybe becouse I do > some conversion > > on the lightpos.z ???? > > See note below... > > > The question: > > In my application a lot of big objects cast shadow, so > i decised i not > > move the camera back until every object (witch make shadow for the > screen ) > > included in the camera space, but use > > 2 shadowmap. Do you implemented the 2 shadowmap sollution > ??? Do you > know > > how this > > working ??? > > I haven't thought about that really... does it work well? > > > > //............................................................ > .......... > > HACK! We are in DX so not [1,1] cube ! z = [0,1] !!! > > .............................. > > LightPos.z += 0.5f; > > I'm pretty sure you want this instead: > > LightPos.z = (LightPos.z + 1.0f) * 0.5f; > > It's hard to say, though  matrix math always confuses me, and to be > honest I'm a little rusty since I haven't worked on this in a while... > >  > Thatcher Ulrich > http://tulrich.com > > > And some other: > > Thanks for visiting my website. > > I'm very grad for receiving your mail. > My english is very poor too. > so, I can't explain all of my website in english. > > Please, look my documentation for the light matrix > to make the perspective shadow map. > > Waiting for your cool game! > Thanks. > > IMAGIRE Takashi > >  >  >  > The light matrix of p.s.m. is decomposed into the following element. > > m=[View][Projection][Post Space Scaling][Post View Inverse][Light > View][Light Projection][Offset] > > View: > View matrix is to move to the position of a camera. > > 0269: D3DXVECTOR4 eye = > D3DXVECTOR4(0.0f,1.4f*MeshRadius,2.5f*MeshRadius,1); > 0270: D3DXMatrixLookAtLH(&mView, (D3DXVECTOR3*)&eye > 0271: , &D3DXVECTOR3(0,0,0) > 0272: , &D3DXVECTOR3(0,1,0)); > > Projection: > Projection matrix is to carry out perspective transformation. > With this matrix, you can control the field of view. > Because this field of view of perspective has nothig to do > with the one of > camera. > You can control the field of view appropriately according to > the resolution > of shadow map. > > 0289: q = 1.0f/(z_maxz_min); > 0292: mProjMap = D3DXMATRIX(1,0,0,0, > 0293: 0,1,0,0, > 0294: 0,0,q,1, > 0295: 0,0,q*z_min,0) * mScale; > > Post Space Scaling: > This matrix scales the post perspective space > to made the close to the world space dimension measurements. > This projection matrix will map the z coordinates, z_min ... z_max > in the view space to 0 ... 1. > Since the range is narrow, matrix converts the coordinate to > the one which > is easy to use. > I adjust te parameters to make the unit vector located at the origin > in the original world space have the almost same magnitude after > transformed. > > 0290: float d = D3DXVec3Length((D3DXVECTOR3*)&eye); > 0291: D3DXMatrixScaling(&mScale, d, d, 10000.0f*d*d); > > Post View Inverse: > The matrix is the transformation from the post perspective > space to the > world space. > To get this matrix, you can use the same way to get a view matrix. > Like the view matrix tranforms from the world space to the > camera space, > you can think of the positon & direction in the post perspective space > as the after transformed space > (in the case of view matrix, this would be the camera space), > and D3DXMatrixLookAtLH, the origin in post perspective space > will be transformed to the origin in the space after projecting. > > 0299: D3DXVECTOR4 cent = D3DXVECTOR4(0,0,0,1); > 0300: D3DXVECTOR4 zdir = D3DXVECTOR4(0,0,1,1); > 0301: D3DXVECTOR4 udir = D3DXVECTOR4(0,1,0,1); > 0302: D3DXVec4Transform(¢, ¢, &mVPm); D3DXVec4Scale(¢, > ¢, 1.0f/cent.w); > 0303: D3DXVec4Transform(&zdir, &zdir, &mVPm); D3DXVec4Scale(&zdir, > &zdir, 1.0f/zdir.w); > 0304: D3DXVec4Transform(&udir, &udir, &mVPm); D3DXVec4Scale(&udir, > &udir, 1.0f/udir.w); > 0305: D3DXMatrixLookAtLH(&mViewI, (D3DXVECTOR3*)¢, > (D3DXVECTOR3*)&zdir, (D3DXVECTOR3*)&udir); > 0308: D3DXMatrixScaling(&mSign,1, 1, 1); > ****: mViewI = mViewI * mSign; > > > Light View: > It is the ordinary view matrix where the light is used as camera. > > 0312: const float zoom =30.f; > 0313: D3DXVECTOR4 eyeP; > 0314: D3DXVec3Transform(&eyeP, &D3DXVECTOR3(zoom*lightDir.x, > zoom*lightDir.y, zoom*lightDir.z), &mVPI); > 0315: D3DXVec4Scale(&eyeP, &eyeP, 1.0f/eyeP.w); > 0316: D3DXMatrixLookAtLH(&mLightView, (D3DXVECTOR3*)&eyeP, > &D3DXVECTOR3(0,0,0), &D3DXVECTOR3(0,1,0)); > > Light Projection: > It is the ordinary projection matrix where the light is used > as camera. > This matrix can adjust the resoluton of the screen reflected > to a shadow > map. > > 0319: const float lz_min = 20.0f; > 0320: const float lz_max = 300.0f; > 0321: D3DXMatrixPerspectiveFovLH(&mProjL > 0322: ,60.0f*PI/180.0f > 0323: ,1 > 0324: ,lz_min, lz_max > 0325: ); > > Offset: > It shifts the origin of screen to adjust the domain of screen > coordinate. > p.s.m. does not use the domain that is far from the camera, > and to use the texture effectively, this shifts the center of texture. > > 0328: D3DXMatrixTranslation(&mShift, 0.5f, 0.5f, 0); > 0329: mLP =mVPI * mLightView * mProjL * mShift; > > > > >  other  > > Looks fantastic ! > Could you outline what do you mean by "in own style" please ? > It really > motivates me , could you reveal some specs (shadow map res, > visible range of > scene its applied > onto etc.) ? > > Thank you for your time > > Petr S. > >  Puvodni zprava  > Od: "Tamas Schlagl" <Tamas.Schlagl@...> > Odpovedet: "Tamas Schlagl" <Tamas.Schlagl@...> > Datum: Wed, 25 Sep 2002 08:24:39 +0200 > > >Hello! > > > > > >I'm implemented "in own style", you can see at > http://www.clevers.com (screenshots > >& movie ). > >This is a very clever trick for shadow maps, but make some > new artifacts... > > > >bye, > >Tamas Schlagl > >Lead Programmer > >Clever's Games Ltd > > > > > > Original Message  > >From: "Petr Smilek" <guru@...> > >To: <gdalgorithmslist@...> > >Sent: Tuesday, September 24, 2002 9:50 PM > >Subject: [Algorithms] Perspective shadow maps > > > > > >> Hi, > >> does anybody successfuly implemented and used > >> perspective shadow maps (except authors) in practice ? > >> Is there some demo showing them in action available ? > >> Thank you in advance. > >> > >> Petr S. > >> > >> > >>  > >> This sf.net email is sponsored by:ThinkGeek > >> Welcome to geek heaven. > >> http://thinkgeek.com/sf > >> _______________________________________________ > >> GDAlgorithmslist mailing list > >> GDAlgorithmslist@... > >> https://lists.sourceforge.net/lists/listinfo/gdalgorithmslist > >> Archives: > >> http://sourceforge.net/mailarchive/forum.php?forum_id=6188 > >> > > > > > > Thanks, I'll keep trying :) > > bye, > Petr S. > >  Puvodni zprava  > Od: "Tamas Schlagl" <Tamas.Schlagl@...> > Odpovedet: "Tamas Schlagl" <Tamas.Schlagl@...> > Datum: Thu, 26 Sep 2002 09:44:56 +0200 > > >Hello, > > > >First of all, some specs: map res: 1024x1024, visible range: 250. > > > >So, I know 4 people, who implented this (psm), but everybody > use other > >technics for converting the light position to post > perspective space... > this > >means "in own style" :) > >The biggest problem with psm is the faliure of z, based on > perspective > >space. To avoid this you must use vertexshaders ( add some > "tolerance" > based > >on w ).... > > > > > >bye, > >Tamas Schlagl > > > > Original Message  > >From: "Petr Smilek" <guru@...> > >To: "Tamas Schlagl" <Tamas.Schlagl@...> > >Sent: Wednesday, September 25, 2002 12:43 PM > >Subject: Re: [Algorithms] Perspective shadow maps > > > > > >> Looks fantastic ! > >> Could you outline what do you mean by "in own style" > please ? It really > >motivates me , could you reveal some specs (shadow map res, > visible range > of > >scene its applied > >> onto etc.) ? > >> > >> Thank you for your time > >> > >> Petr S. > > > > > > > > > > > >  > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > GDAlgorithmslist mailing list > GDAlgorithmslist@... > https://lists.sourceforge.net/lists/listinfo/gdalgorithmslist > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=6188 > 
From: Gary McTaggart <gary@va...>  20021121 17:39:20

Have you run into any problems with the cases that degenerate into a traditional shadow map? Thanks, Gary > Original Message > From: Tamas Schlagl [mailto:Tamas.Schlagl@...] > Sent: Thursday, November 21, 2002 2:04 AM > To: gdalgorithmslist@... > Subject: Re: [Algorithms] Perspective shadow maps problems > > > Hi! > > Maybe my old psm emails help you! > > I'm playing a lot with psm, and after some "hacking" i made this: > http://www.clevers.com > > bye, fanthomas > > > This came form the author of the paper: > > Hmm, > > I am not a DX expert and I don't know your matrix class, but > the following > things seem suspicious to me: > >  just adding 0.5 does not map 1..1 to 0..1. Furthermore, I > guess that > emulateViewport already maps to the right range, so you > probably don't have > to do anything here. > >  why do you compute MV*P ? Do you use row or column vectors? Usually, > column > vectors are used that are multiplied to the matrices from the > right. In that > case, you have to compute P*MV, i.e. it first does the modelview > transformation and then the projection. > >  in postperspective space, parallel lights become point > lights. So the > postperspective light is *not* orthogonal! > > Maybe this helped, > > Marc > > > On Friday 23 August 2002 11:47, you wrote: > > Hello! > > > > > > I read your Perspective Shadow Mapping paper, after that I > try to use in > > our upcoming game called Steel Of Haste ( you can see > screenshots & movie > > at http://www.clevers.com ). > > So I have an working version but I have a one intresting > problem and an > > other question, please help me if you can! > > > > The problem description: > > The game use DX8.1 so the ppspace isn't the [1,1]^3 cube, but > > [1,1],[1,1],[0,1] cube. > > Definetly I use one directional light. > > If I do everything like you write down on your website,I have an > > intresting effect: > > When I rotate or move my camera ( the light direction not do > > anything), the shadows start move away ( go from his > position, like i move > > the > > light direction ). On the shadow I see something like a > perspective > > distorsion from the camera. > > As I think this is because my light postition in > postperstective > > space isn't at a right position, but why ? Maybe becouse I do some > > conversion on the lightpos.z ???? > > For a quick & dirty sollution i substract from the > cameradirection the > > cameradirection paraler part of light direction, after that > the cameradir > > is perpendicular for the light direction, > > and after this the shadow working perfectly, but i have > other atrifacts :/ > > Do you know what is the problem ??? I included the > source code of the > > matrix generation..... maybe this help a little.... > > > > The question: > > In my application a lot of big objects cast shadow, so i > decised i not > > move the camera back until every object (witch make shadow for the > screen ) > > included in the camera space, but use > > 2 shadowmap. Do you implemented the 2 shadowmap sollution > ??? How this > > working ??? > > > > > > > > Thank you, > > Tamas Schlagl > > > > > > P.S.: I hope you can read my letter, sorry, my engilsh is > very poor. :/ > > > > The source code: > > > > //..........Get the light direction................. > > LightDir.Set( GETVAR(LDir[0]), GETVAR(LDir[1]), GETVAR(LDir[2]) ); > > LightDir.Norm(); > > LightPos = LightDir; // At now, the lightpos must > be LightDir > > (becouse the DX can't xchange the shadowmapz < pixelz > equation... :( > > > > //........... my actual camera for the scene................ > > Camera_lookAt = CameraC>GetTarget(); > > CameraPos = CameraC>GetPos(); > > CameraDir = Camera_lookAt  CameraPos ; > > CameraDir.Norm(); > > > > // CameraDir = CameraDir  LightDir; > // CameraDir = > > CameraID  ( CameraDir paraler part of LightDir ) ??????? > WHY ??????? > > CameraDir.Norm(); > > Camera_lookAt = CameraPos + CameraDir; > > > > ///.... setup the shadowmap camera.......... > > CameraCamera.Ident(); > > CameraCamera.SetupViewport( GETVAR( NearPlane ) , GETVAR( > FarPlane ), 1, > > GETVAR( Fov ), 0,0,SHADOWMAP_SIZE, SHADOWMAP_SIZE ); // get the > > nearplane & the farplane & use the real fov! > > CameraCamera.SetPos( CameraPos ); > > CameraCamera.SetTarget( Camera_lookAt ); > > CameraCamera.SetUpVector( CameraC>GetUpVector() ); > > Render>EmulateViewport( CameraCamera, 0, NULL ); > // generate > > camera matrix & projection matrix > > > > CameraMatrix = Render>GetCameraMatrix(); > // get > > the matrixes > > ProjMat = Render>GetProjectionMatrix(); > > CameraMatrix.Concat( &ProjMat ); > // > > make the viewmatrix ( MV*P ) > > > > > //............................................................ > .......... > > LightPos.Rotate_w0( CameraMatrix ); > // > > rotate the lightpos ( x,y,z,0 ) to screenspace ! > > > //............................................................ > .......... > > > > > > > //............................................................ > .......... > > HACK! We are in DX so not [1,1] cube ! z = [0,1] !!! > > LightPos.z += 0.5f; > > Light_lookAt = cVector( 0,0,0.5 ); > > > //............................................................ > .......... > > > > //.................................. SM > camera........................ > > LightCamera.Ident(); > > LightCamera.SetupViewport( GETVAR( LightNear ), GETVAR( > LightFar ), 1, 0, > > 0,0,SHADOWMAP_SIZE,SHADOWMAP_SIZE ); > > LightCamera.SetOrtho( true ); // ORTHOGONAL VIEW!!! > > LightCamera.SetPos( LightPos ); > > LightCamera.SetTarget( Light_lookAt ); > > LightCamera.SetUpVector( cVector(0,0,1) ); // Z is > the up vector! > > Render>EmulateViewport( LightCamera, GETVAR( PlaneSize ), > NULL ); // > > generate LMV & LP > > > > LightM = Render>GetCameraMatrix(); > > LightProj = Render>GetProjectionMatrix(); > > LightM.Concat( &LightProj ); // > create the > > LightMatrix > > > > CameraCamera.SetXpos( 1 ); > > CameraCamera.SetYpos( 1 ); > > CameraCamera.SetWidht( SHADOWMAP_SIZE  2 ); > > CameraCamera.SetHeight( SHADOWMAP_SIZE  2 ); > > Render>SetViewport( CameraCamera, 0, &LightM ); // Use the > CCamera > > for the rendering to the shadowmap BUT the PROJECTION > MATRIX MULTIPLIDE > > WITH THE LIGHTMATRIX! > > > > LightMatrix = Render>GetCameraMatrix(); > > LightProj = Render>GetProjectionMatrix(); > > LightMatrix.Concat( &LightProj ); > // > THIS > > IS THE matrix what we use as TextureMatrix when we want to use the > > shadowmap! > > > > // LightMatrix contain: MV*P*MVL*PL > >  > EMail: Marc.Stamminger@... > phone: +49 3643 583733 (fax: 3709) > > > > > This from Ulrich: > > On Aug 23, 2002 at 03:31 +0200, Tamas Schlagl wrote: > > > > The problem description: > > The game use DX8.1 so the ppspace isn't the [1,1]^3 cube, but > > [1,1],[1,1],[0,1] cube. > > Definetly I use one directional light. > > If I do everything like you write down on your > website,I have an > > intresting effect: > > When I rotate or move my camera ( the light direction not do > > anything), the shadows start move away ( go from his > position, like i > move > > the > > light direction ). On the shadow I see something like > a perspective > > distorsion from the camera. > > As I think this is because my light postition in > postperstective > > space > > isn't at a right position, but why ? Maybe becouse I do > some conversion > > on the lightpos.z ???? > > See note below... > > > The question: > > In my application a lot of big objects cast shadow, so > i decised i not > > move the camera back until every object (witch make shadow for the > screen ) > > included in the camera space, but use > > 2 shadowmap. Do you implemented the 2 shadowmap sollution > ??? Do you > know > > how this > > working ??? > > I haven't thought about that really... does it work well? > > > > //............................................................ > .......... > > HACK! We are in DX so not [1,1] cube ! z = [0,1] !!! > > .............................. > > LightPos.z += 0.5f; > > I'm pretty sure you want this instead: > > LightPos.z = (LightPos.z + 1.0f) * 0.5f; > > It's hard to say, though  matrix math always confuses me, and to be > honest I'm a little rusty since I haven't worked on this in a while... > >  > Thatcher Ulrich > http://tulrich.com > > > And some other: > > Thanks for visiting my website. > > I'm very grad for receiving your mail. > My english is very poor too. > so, I can't explain all of my website in english. > > Please, look my documentation for the light matrix > to make the perspective shadow map. > > Waiting for your cool game! > Thanks. > > IMAGIRE Takashi > >  >  >  > The light matrix of p.s.m. is decomposed into the following element. > > m=[View][Projection][Post Space Scaling][Post View Inverse][Light > View][Light Projection][Offset] > > View: > View matrix is to move to the position of a camera. > > 0269: D3DXVECTOR4 eye = > D3DXVECTOR4(0.0f,1.4f*MeshRadius,2.5f*MeshRadius,1); > 0270: D3DXMatrixLookAtLH(&mView, (D3DXVECTOR3*)&eye > 0271: , &D3DXVECTOR3(0,0,0) > 0272: , &D3DXVECTOR3(0,1,0)); > > Projection: > Projection matrix is to carry out perspective transformation. > With this matrix, you can control the field of view. > Because this field of view of perspective has nothig to do > with the one of > camera. > You can control the field of view appropriately according to > the resolution > of shadow map. > > 0289: q = 1.0f/(z_maxz_min); > 0292: mProjMap = D3DXMATRIX(1,0,0,0, > 0293: 0,1,0,0, > 0294: 0,0,q,1, > 0295: 0,0,q*z_min,0) * mScale; > > Post Space Scaling: > This matrix scales the post perspective space > to made the close to the world space dimension measurements. > This projection matrix will map the z coordinates, z_min ... z_max > in the view space to 0 ... 1. > Since the range is narrow, matrix converts the coordinate to > the one which > is easy to use. > I adjust te parameters to make the unit vector located at the origin > in the original world space have the almost same magnitude after > transformed. > > 0290: float d = D3DXVec3Length((D3DXVECTOR3*)&eye); > 0291: D3DXMatrixScaling(&mScale, d, d, 10000.0f*d*d); > > Post View Inverse: > The matrix is the transformation from the post perspective > space to the > world space. > To get this matrix, you can use the same way to get a view matrix. > Like the view matrix tranforms from the world space to the > camera space, > you can think of the positon & direction in the post perspective space > as the after transformed space > (in the case of view matrix, this would be the camera space), > and D3DXMatrixLookAtLH, the origin in post perspective space > will be transformed to the origin in the space after projecting. > > 0299: D3DXVECTOR4 cent = D3DXVECTOR4(0,0,0,1); > 0300: D3DXVECTOR4 zdir = D3DXVECTOR4(0,0,1,1); > 0301: D3DXVECTOR4 udir = D3DXVECTOR4(0,1,0,1); > 0302: D3DXVec4Transform(¢, ¢, &mVPm); D3DXVec4Scale(¢, > ¢, 1.0f/cent.w); > 0303: D3DXVec4Transform(&zdir, &zdir, &mVPm); D3DXVec4Scale(&zdir, > &zdir, 1.0f/zdir.w); > 0304: D3DXVec4Transform(&udir, &udir, &mVPm); D3DXVec4Scale(&udir, > &udir, 1.0f/udir.w); > 0305: D3DXMatrixLookAtLH(&mViewI, (D3DXVECTOR3*)¢, > (D3DXVECTOR3*)&zdir, (D3DXVECTOR3*)&udir); > 0308: D3DXMatrixScaling(&mSign,1, 1, 1); > ****: mViewI = mViewI * mSign; > > > Light View: > It is the ordinary view matrix where the light is used as camera. > > 0312: const float zoom =30.f; > 0313: D3DXVECTOR4 eyeP; > 0314: D3DXVec3Transform(&eyeP, &D3DXVECTOR3(zoom*lightDir.x, > zoom*lightDir.y, zoom*lightDir.z), &mVPI); > 0315: D3DXVec4Scale(&eyeP, &eyeP, 1.0f/eyeP.w); > 0316: D3DXMatrixLookAtLH(&mLightView, (D3DXVECTOR3*)&eyeP, > &D3DXVECTOR3(0,0,0), &D3DXVECTOR3(0,1,0)); > > Light Projection: > It is the ordinary projection matrix where the light is used > as camera. > This matrix can adjust the resoluton of the screen reflected > to a shadow > map. > > 0319: const float lz_min = 20.0f; > 0320: const float lz_max = 300.0f; > 0321: D3DXMatrixPerspectiveFovLH(&mProjL > 0322: ,60.0f*PI/180.0f > 0323: ,1 > 0324: ,lz_min, lz_max > 0325: ); > > Offset: > It shifts the origin of screen to adjust the domain of screen > coordinate. > p.s.m. does not use the domain that is far from the camera, > and to use the texture effectively, this shifts the center of texture. > > 0328: D3DXMatrixTranslation(&mShift, 0.5f, 0.5f, 0); > 0329: mLP =mVPI * mLightView * mProjL * mShift; > > > > >  other  > > Looks fantastic ! > Could you outline what do you mean by "in own style" please ? > It really > motivates me , could you reveal some specs (shadow map res, > visible range of > scene its applied > onto etc.) ? > > Thank you for your time > > Petr S. > >  Puvodni zprava  > Od: "Tamas Schlagl" <Tamas.Schlagl@...> > Odpovedet: "Tamas Schlagl" <Tamas.Schlagl@...> > Datum: Wed, 25 Sep 2002 08:24:39 +0200 > > >Hello! > > > > > >I'm implemented "in own style", you can see at > http://www.clevers.com (screenshots > >& movie ). > >This is a very clever trick for shadow maps, but make some > new artifacts... > > > >bye, > >Tamas Schlagl > >Lead Programmer > >Clever's Games Ltd > > > > > > Original Message  > >From: "Petr Smilek" <guru@...> > >To: <gdalgorithmslist@...> > >Sent: Tuesday, September 24, 2002 9:50 PM > >Subject: [Algorithms] Perspective shadow maps > > > > > >> Hi, > >> does anybody successfuly implemented and used > >> perspective shadow maps (except authors) in practice ? > >> Is there some demo showing them in action available ? > >> Thank you in advance. > >> > >> Petr S. > >> > >> > >>  > >> This sf.net email is sponsored by:ThinkGeek > >> Welcome to geek heaven. > >> http://thinkgeek.com/sf > >> _______________________________________________ > >> GDAlgorithmslist mailing list > >> GDAlgorithmslist@... > >> https://lists.sourceforge.net/lists/listinfo/gdalgorithmslist > >> Archives: > >> http://sourceforge.net/mailarchive/forum.php?forum_id=6188 > >> > > > > > > Thanks, I'll keep trying :) > > bye, > Petr S. > >  Puvodni zprava  > Od: "Tamas Schlagl" <Tamas.Schlagl@...> > Odpovedet: "Tamas Schlagl" <Tamas.Schlagl@...> > Datum: Thu, 26 Sep 2002 09:44:56 +0200 > > >Hello, > > > >First of all, some specs: map res: 1024x1024, visible range: 250. > > > >So, I know 4 people, who implented this (psm), but everybody > use other > >technics for converting the light position to post > perspective space... > this > >means "in own style" :) > >The biggest problem with psm is the faliure of z, based on > perspective > >space. To avoid this you must use vertexshaders ( add some > "tolerance" > based > >on w ).... > > > > > >bye, > >Tamas Schlagl > > > > Original Message  > >From: "Petr Smilek" <guru@...> > >To: "Tamas Schlagl" <Tamas.Schlagl@...> > >Sent: Wednesday, September 25, 2002 12:43 PM > >Subject: Re: [Algorithms] Perspective shadow maps > > > > > >> Looks fantastic ! > >> Could you outline what do you mean by "in own style" > please ? It really > >motivates me , could you reveal some specs (shadow map res, > visible range > of > >scene its applied > >> onto etc.) ? > >> > >> Thank you for your time > >> > >> Petr S. > > > > > > > > > > > >  > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf > _______________________________________________ > GDAlgorithmslist mailing list > GDAlgorithmslist@... > https://lists.sourceforge.net/lists/listinfo/gdalgorithmslist > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_id=6188 > 
From: Aras Pranckevicius <praaras@ta...>  20021121 16:52:56

> > Given an arbitrary time t. How do I interpolate the keyframe data? My > guess > > is to SLERP the rotation part and to LERP the scale and the translation > > parts. > > Yes. Or instead of LERP/SLERP do something more fancy (catmullrom/squad, etc.). This, of course, in the case where LERP/SLERP aren't good enough. Aras Pranckevicius aka NeARAZ http://www.gim.ktu.lt/nesnausk/nearaz/ 
From: Pierre Terdiman <p.terdiman@wa...>  20021121 13:21:05

> Given an arbitrary time t. How do I interpolate the keyframe data? My guess > is to SLERP the rotation part and to LERP the scale and the translation > parts. Yes. > Finally, how can create a matrix out of this information? Is it > simply converting the interpolated quaternion back to a matrix and then > inserting the interpolated translation? Yes. > For the scale part I have only a very unsure guess. Do I have to add the > interpolated scale value to the elemts of the trace of the matrix? 1) Make a matrix from the quat 2) first row * scale.x second row * scale.y third row * scale.z 3) insert translation 
From: Dirk Gregorius <dirk@di...>  20021121 13:02:35

Hi, I have imported a skinned mesh out of a xfile into my application. The keyframe data is split into three parts: Vector3D Scale; Vector3D Translation; Quaternion Rotation; Given an arbitrary time t. How do I interpolate the keyframe data? My guess is to SLERP the rotation part and to LERP the scale and the translation parts. Finally, how can create a matrix out of this information? Is it simply converting the interpolated quaternion back to a matrix and then inserting the interpolated translation? For the scale part I have only a very unsure guess. Do I have to add the interpolated scale value to the elemts of the trace of the matrix? Or will this work: Build a scale, translation, and rotaionmatrix out of the interpolated data and then multiply the results? But in which order? Hope this is not Off Topic!! Kind regards Dirk 
From: Tamas Schlagl <Tamas.S<chlagl@cl...>  20021121 10:05:13

Hi! Maybe my old psm emails help you! I'm playing a lot with psm, and after some "hacking" i made this: http://www.clevers.com bye, fanthomas This came form the author of the paper: Hmm, I am not a DX expert and I don't know your matrix class, but the following things seem suspicious to me:  just adding 0.5 does not map 1..1 to 0..1. Furthermore, I guess that emulateViewport already maps to the right range, so you probably don't have to do anything here.  why do you compute MV*P ? Do you use row or column vectors? Usually, column vectors are used that are multiplied to the matrices from the right. In that case, you have to compute P*MV, i.e. it first does the modelview transformation and then the projection.  in postperspective space, parallel lights become point lights. So the postperspective light is *not* orthogonal! Maybe this helped, Marc On Friday 23 August 2002 11:47, you wrote: > Hello! > > > I read your Perspective Shadow Mapping paper, after that I try to use in > our upcoming game called Steel Of Haste ( you can see screenshots & movie > at http://www.clevers.com ). > So I have an working version but I have a one intresting problem and an > other question, please help me if you can! > > The problem description: > The game use DX8.1 so the ppspace isn't the [1,1]^3 cube, but > [1,1],[1,1],[0,1] cube. > Definetly I use one directional light. > If I do everything like you write down on your website,I have an > intresting effect: > When I rotate or move my camera ( the light direction not do > anything), the shadows start move away ( go from his position, like i move > the > light direction ). On the shadow I see something like a perspective > distorsion from the camera. > As I think this is because my light postition in postperstective > space isn't at a right position, but why ? Maybe becouse I do some > conversion on the lightpos.z ???? > For a quick & dirty sollution i substract from the cameradirection the > cameradirection paraler part of light direction, after that the cameradir > is perpendicular for the light direction, > and after this the shadow working perfectly, but i have other atrifacts :/ > Do you know what is the problem ??? I included the source code of the > matrix generation..... maybe this help a little.... > > The question: > In my application a lot of big objects cast shadow, so i decised i not > move the camera back until every object (witch make shadow for the screen ) > included in the camera space, but use > 2 shadowmap. Do you implemented the 2 shadowmap sollution ??? How this > working ??? > > > > Thank you, > Tamas Schlagl > > > P.S.: I hope you can read my letter, sorry, my engilsh is very poor. :/ > > The source code: > > //..........Get the light direction................. > LightDir.Set( GETVAR(LDir[0]), GETVAR(LDir[1]), GETVAR(LDir[2]) ); > LightDir.Norm(); > LightPos = LightDir; // At now, the lightpos must be LightDir > (becouse the DX can't xchange the shadowmapz < pixelz equation... :( > > //........... my actual camera for the scene................ > Camera_lookAt = CameraC>GetTarget(); > CameraPos = CameraC>GetPos(); > CameraDir = Camera_lookAt  CameraPos ; > CameraDir.Norm(); > > // CameraDir = CameraDir  LightDir; // CameraDir = > CameraID  ( CameraDir paraler part of LightDir ) ??????? WHY ??????? > CameraDir.Norm(); > Camera_lookAt = CameraPos + CameraDir; > > ///.... setup the shadowmap camera.......... > CameraCamera.Ident(); > CameraCamera.SetupViewport( GETVAR( NearPlane ) , GETVAR( FarPlane ), 1, > GETVAR( Fov ), 0,0,SHADOWMAP_SIZE, SHADOWMAP_SIZE ); // get the > nearplane & the farplane & use the real fov! > CameraCamera.SetPos( CameraPos ); > CameraCamera.SetTarget( Camera_lookAt ); > CameraCamera.SetUpVector( CameraC>GetUpVector() ); > Render>EmulateViewport( CameraCamera, 0, NULL ); // generate > camera matrix & projection matrix > > CameraMatrix = Render>GetCameraMatrix(); // get > the matrixes > ProjMat = Render>GetProjectionMatrix(); > CameraMatrix.Concat( &ProjMat ); // > make the viewmatrix ( MV*P ) > > //...................................................................... > LightPos.Rotate_w0( CameraMatrix ); // > rotate the lightpos ( x,y,z,0 ) to screenspace ! > //...................................................................... > > > //...................................................................... > HACK! We are in DX so not [1,1] cube ! z = [0,1] !!! > LightPos.z += 0.5f; > Light_lookAt = cVector( 0,0,0.5 ); > //...................................................................... > > //.................................. SM camera........................ > LightCamera.Ident(); > LightCamera.SetupViewport( GETVAR( LightNear ), GETVAR( LightFar ), 1, 0, > 0,0,SHADOWMAP_SIZE,SHADOWMAP_SIZE ); > LightCamera.SetOrtho( true ); // ORTHOGONAL VIEW!!! > LightCamera.SetPos( LightPos ); > LightCamera.SetTarget( Light_lookAt ); > LightCamera.SetUpVector( cVector(0,0,1) ); // Z is the up vector! > Render>EmulateViewport( LightCamera, GETVAR( PlaneSize ), NULL ); // > generate LMV & LP > > LightM = Render>GetCameraMatrix(); > LightProj = Render>GetProjectionMatrix(); > LightM.Concat( &LightProj ); // create the > LightMatrix > > CameraCamera.SetXpos( 1 ); > CameraCamera.SetYpos( 1 ); > CameraCamera.SetWidht( SHADOWMAP_SIZE  2 ); > CameraCamera.SetHeight( SHADOWMAP_SIZE  2 ); > Render>SetViewport( CameraCamera, 0, &LightM ); // Use the CCamera > for the rendering to the shadowmap BUT the PROJECTION MATRIX MULTIPLIDE > WITH THE LIGHTMATRIX! > > LightMatrix = Render>GetCameraMatrix(); > LightProj = Render>GetProjectionMatrix(); > LightMatrix.Concat( &LightProj ); // THIS > IS THE matrix what we use as TextureMatrix when we want to use the > shadowmap! > > // LightMatrix contain: MV*P*MVL*PL  EMail: Marc.Stamminger@... phone: +49 3643 583733 (fax: 3709) This from Ulrich: On Aug 23, 2002 at 03:31 +0200, Tamas Schlagl wrote: > > The problem description: > The game use DX8.1 so the ppspace isn't the [1,1]^3 cube, but > [1,1],[1,1],[0,1] cube. > Definetly I use one directional light. > If I do everything like you write down on your website,I have an > intresting effect: > When I rotate or move my camera ( the light direction not do > anything), the shadows start move away ( go from his position, like i move > the > light direction ). On the shadow I see something like a perspective > distorsion from the camera. > As I think this is because my light postition in postperstective > space > isn't at a right position, but why ? Maybe becouse I do some conversion > on the lightpos.z ???? See note below... > The question: > In my application a lot of big objects cast shadow, so i decised i not > move the camera back until every object (witch make shadow for the screen ) > included in the camera space, but use > 2 shadowmap. Do you implemented the 2 shadowmap sollution ??? Do you know > how this > working ??? I haven't thought about that really... does it work well? > //...................................................................... > HACK! We are in DX so not [1,1] cube ! z = [0,1] !!! > .............................. > LightPos.z += 0.5f; I'm pretty sure you want this instead: LightPos.z = (LightPos.z + 1.0f) * 0.5f; It's hard to say, though  matrix math always confuses me, and to be honest I'm a little rusty since I haven't worked on this in a while...  Thatcher Ulrich http://tulrich.com And some other: Thanks for visiting my website. I'm very grad for receiving your mail. My english is very poor too. so, I can't explain all of my website in english. Please, look my documentation for the light matrix to make the perspective shadow map. Waiting for your cool game! Thanks. IMAGIRE Takashi   The light matrix of p.s.m. is decomposed into the following element. m=[View][Projection][Post Space Scaling][Post View Inverse][Light View][Light Projection][Offset] View: View matrix is to move to the position of a camera. 0269: D3DXVECTOR4 eye = D3DXVECTOR4(0.0f,1.4f*MeshRadius,2.5f*MeshRadius,1); 0270: D3DXMatrixLookAtLH(&mView, (D3DXVECTOR3*)&eye 0271: , &D3DXVECTOR3(0,0,0) 0272: , &D3DXVECTOR3(0,1,0)); Projection: Projection matrix is to carry out perspective transformation. With this matrix, you can control the field of view. Because this field of view of perspective has nothig to do with the one of camera. You can control the field of view appropriately according to the resolution of shadow map. 0289: q = 1.0f/(z_maxz_min); 0292: mProjMap = D3DXMATRIX(1,0,0,0, 0293: 0,1,0,0, 0294: 0,0,q,1, 0295: 0,0,q*z_min,0) * mScale; Post Space Scaling: This matrix scales the post perspective space to made the close to the world space dimension measurements. This projection matrix will map the z coordinates, z_min ... z_max in the view space to 0 ... 1. Since the range is narrow, matrix converts the coordinate to the one which is easy to use. I adjust te parameters to make the unit vector located at the origin in the original world space have the almost same magnitude after transformed. 0290: float d = D3DXVec3Length((D3DXVECTOR3*)&eye); 0291: D3DXMatrixScaling(&mScale, d, d, 10000.0f*d*d); Post View Inverse: The matrix is the transformation from the post perspective space to the world space. To get this matrix, you can use the same way to get a view matrix. Like the view matrix tranforms from the world space to the camera space, you can think of the positon & direction in the post perspective space as the after transformed space (in the case of view matrix, this would be the camera space), and D3DXMatrixLookAtLH, the origin in post perspective space will be transformed to the origin in the space after projecting. 0299: D3DXVECTOR4 cent = D3DXVECTOR4(0,0,0,1); 0300: D3DXVECTOR4 zdir = D3DXVECTOR4(0,0,1,1); 0301: D3DXVECTOR4 udir = D3DXVECTOR4(0,1,0,1); 0302: D3DXVec4Transform(¢, ¢, &mVPm); D3DXVec4Scale(¢, ¢, 1.0f/cent.w); 0303: D3DXVec4Transform(&zdir, &zdir, &mVPm); D3DXVec4Scale(&zdir, &zdir, 1.0f/zdir.w); 0304: D3DXVec4Transform(&udir, &udir, &mVPm); D3DXVec4Scale(&udir, &udir, 1.0f/udir.w); 0305: D3DXMatrixLookAtLH(&mViewI, (D3DXVECTOR3*)¢, (D3DXVECTOR3*)&zdir, (D3DXVECTOR3*)&udir); 0308: D3DXMatrixScaling(&mSign,1, 1, 1); ****: mViewI = mViewI * mSign; Light View: It is the ordinary view matrix where the light is used as camera. 0312: const float zoom =30.f; 0313: D3DXVECTOR4 eyeP; 0314: D3DXVec3Transform(&eyeP, &D3DXVECTOR3(zoom*lightDir.x, zoom*lightDir.y, zoom*lightDir.z), &mVPI); 0315: D3DXVec4Scale(&eyeP, &eyeP, 1.0f/eyeP.w); 0316: D3DXMatrixLookAtLH(&mLightView, (D3DXVECTOR3*)&eyeP, &D3DXVECTOR3(0,0,0), &D3DXVECTOR3(0,1,0)); Light Projection: It is the ordinary projection matrix where the light is used as camera. This matrix can adjust the resoluton of the screen reflected to a shadow map. 0319: const float lz_min = 20.0f; 0320: const float lz_max = 300.0f; 0321: D3DXMatrixPerspectiveFovLH(&mProjL 0322: ,60.0f*PI/180.0f 0323: ,1 0324: ,lz_min, lz_max 0325: ); Offset: It shifts the origin of screen to adjust the domain of screen coordinate. p.s.m. does not use the domain that is far from the camera, and to use the texture effectively, this shifts the center of texture. 0328: D3DXMatrixTranslation(&mShift, 0.5f, 0.5f, 0); 0329: mLP =mVPI * mLightView * mProjL * mShift;  other  Looks fantastic ! Could you outline what do you mean by "in own style" please ? It really motivates me , could you reveal some specs (shadow map res, visible range of scene its applied onto etc.) ? Thank you for your time Petr S.  Puvodni zprava  Od: "Tamas Schlagl" <Tamas.Schlagl@...> Odpovedet: "Tamas Schlagl" <Tamas.Schlagl@...> Datum: Wed, 25 Sep 2002 08:24:39 +0200 >Hello! > > >I'm implemented "in own style", you can see at http://www.clevers.com (screenshots >& movie ). >This is a very clever trick for shadow maps, but make some new artifacts... > >bye, >Tamas Schlagl >Lead Programmer >Clever's Games Ltd > > > Original Message  >From: "Petr Smilek" <guru@...> >To: <gdalgorithmslist@...> >Sent: Tuesday, September 24, 2002 9:50 PM >Subject: [Algorithms] Perspective shadow maps > > >> Hi, >> does anybody successfuly implemented and used >> perspective shadow maps (except authors) in practice ? >> Is there some demo showing them in action available ? >> Thank you in advance. >> >> Petr S. >> >> >>  >> This sf.net email is sponsored by:ThinkGeek >> Welcome to geek heaven. >> http://thinkgeek.com/sf >> _______________________________________________ >> GDAlgorithmslist mailing list >> GDAlgorithmslist@... >> https://lists.sourceforge.net/lists/listinfo/gdalgorithmslist >> Archives: >> http://sourceforge.net/mailarchive/forum.php?forum_id=6188 >> > > Thanks, I'll keep trying :) bye, Petr S.  Puvodni zprava  Od: "Tamas Schlagl" <Tamas.Schlagl@...> Odpovedet: "Tamas Schlagl" <Tamas.Schlagl@...> Datum: Thu, 26 Sep 2002 09:44:56 +0200 >Hello, > >First of all, some specs: map res: 1024x1024, visible range: 250. > >So, I know 4 people, who implented this (psm), but everybody use other >technics for converting the light position to post perspective space... this >means "in own style" :) >The biggest problem with psm is the faliure of z, based on perspective >space. To avoid this you must use vertexshaders ( add some "tolerance" based >on w ).... > > >bye, >Tamas Schlagl > > Original Message  >From: "Petr Smilek" <guru@...> >To: "Tamas Schlagl" <Tamas.Schlagl@...> >Sent: Wednesday, September 25, 2002 12:43 PM >Subject: Re: [Algorithms] Perspective shadow maps > > >> Looks fantastic ! >> Could you outline what do you mean by "in own style" please ? It really >motivates me , could you reveal some specs (shadow map res, visible range of >scene its applied >> onto etc.) ? >> >> Thank you for your time >> >> Petr S. > > > 
From: Tom DaSilva <tomdasilva8@ya...>  20021121 09:11:27

> In DX the PP cube isn't (1,1,1)  ( 1,1,1, ) > just (1,1,0)  (1,1,1) We use our own projection matrix and they come from OpenGL specifications. > I saw 4 different version of the light to post > perspective space :) In the archives, math gurus haven't said their opinions about this. Isn't there only one 'really correct' solution ? Could someone clarify definitively the problem ? Tom. __________________________________________________ Do you Yahoo!? Yahoo! Mail Plus Powerful. Affordable. Sign up now. http://mailplus.yahoo.com 