Re: [Algorithms] General-purpose shadowbuffer implementation. From: Jonathan Blow - 2004-08-29 05:22:05 ```One other thing I want to clarify is that the hyperbolic mapping doesn't=20 fall into the class of "odd warpings". It is actually an analytical=20 solution that provides the Right Answer. (I was discussing Odd Warpings=20 in the realm of the parabolic thing we were talking about earlier, in=20 order to make it more like the hyperbolic case, but it's sort of the=20 difference between a hack and the Right Thing). The job of the hyperbola is just to provide an approximation of the view=20 frustum that can be stated in closed form, that is easy to intersect=20 lines with, and that doesn't blow up to crazy resolution at the near=20 plane. You intersect the projectors from the light source with that=20 hyperbola. This gives you 2 intersection points in the general case. =20 You pick the one with the lowest positive z-distance to the camera, then=20 you divide by that z to warp the uv map. So it's a lot more sensible, and less arbitrary, than may have seemed=20 from the offhand way I was talking about it... -J. Jonathan Blow wrote: > I think you're making the problem too hard. > > It's okay if some things deep in the scene accidentally get=20 > high-resolution shadows, as long as the reason that high resolution=20 > patch exists, is because someone near in the scene needed it. In this=20 > case, resolution is not being wasted, it's just that someone deep in=20 > the scene fortuitously landed in a spot where they lucked out and got=20 > a bonus. > > i.e. your goal is to give a *minimum* resolution to each of those=20 > points in the scene, without wasting shadow buffer resolution. But=20 > that's not the same as constraining the resolution of each point in=20 > the scene, because the resolution is free to be above minimum. So,=20 > the problem is easier. > > In the hyperbolic mapping, there is enough shadow buffer resolution to=20 > cover every projector from the light source, at the point of nearest=20 > resolution. As you cast a line through the frustum, of course the=20 > needed resolution is going to vary (in the general case). The=20 > hyperbolic mapping solves for the maximum resolution, then provides=20 > that resolution for the entire projector. > > So, the problem is made into a 2D one and is solvable. > > -J. > > > Tom Forsyth wrote: > >> So my fundamental point about all these cunning warps is you're=20 >> trying to >> find the 3D-2D mapping that does the best thing. The problem is, the=20 >> domain >> you're trying to cover is fundamentally 3D. >> >> Imagine a volume filled with spheres that are quite small and don't=20 >> touch, >> so that they can cast shadows on each other, and you can see a=20 >> majority of >> the spheres. This case is the one that says to me that the problem is=20 >> a 3D >> one - you are trying to find a mapping for the shadowbuffer that=20 >> fills this >> volume. But that's asking a 2D surface to fill a volume - can't be don= e >> unless you can throw away a dimension. The problem is, the only one=20 >> you can >> throw away and maintain even texel density is along the camera's Z=20 >> axis. But >> the only one you are _allowed_ to throw away is the one radiating out=20 >> from >> the light (that's why it's a shadowmap :-) >> >> This says to me that trying to find a single mapping is doomed, no=20 >> matter >> how clever your tech. But maybe my intuition is leading me astray. >> >> I think if you want to find one that maps onto something like a=20 >> ground plane >> with good texel density, then maybe you can do it with some odd=20 >> warpings. >> But that doesn't cover the general case. Admittedly, it covers a lot o= f >> outdoor game cases, so it might still be useful. But it's not >> general-purpose. >> >> TomF. >> >> >> =20 >> >>> -----Original Message----- >>> From: gdalgorithms-list-admin@...=20 >>> [mailto:gdalgorithms-list-admin@...] On Behalf Of=20 >>> Jonathan Blow >>> Sent: 28 August 2004 15:33 >>> To: gdalgorithms-list@... >>> Subject: Re: [Algorithms] General-purpose shadowbuffer implementation. >>> >>> >>> Tom Forsyth wrote: >>> >>> =20 >>> >>>> I meant they don't solve that case, not that the frustums =20 >>> >>> actually duel. If >>> =20 >>> >>>> you're looking at a light, rendering with a paraboloid map =20 >>> >>> (I assume it's >>> =20 >>> >>>> used in the same sense as a cube-map, but without the =20 >>> >>> multiple chunks) means >>> =20 >>> >>>> that you have too many texels near to the light and too few =20 >>> >>> near the camera. >>> =20 >>> >>>> That's what I mean by the duelling frustum case. >>>> >>>> >>>> =20 >>> >>> Okay, I get what you're saying. The thing is though, once you've=20 >>> decided to use a paraboloid, there's no point in worrying about=20 >>> things like linearity any more. At which point, you can throw some=20 >>> kind of warping function onto the surface of the paraboloid to try=20 >>> and account for perspective. Since the paraboloid is easily=20 >>> parameterized, you ought to be able to map the distortion to=20 >>> something pretty close to the right answer, and thus beat duelling=20 >>> frustums. That's what I was thinking anyway, but I didn't think=20 >>> about it too hard. >>> >>> The view-dependant hyperbola on the other hand basically gives you=20 >>> the exact warping function that you want no matter what, which is=20 >>> why I would do that instead of a hyperbola, except hey, I can't=20 >>> render curved surfaces. (And honestly, trying to tessellate=20 >>> geometry to the degree that would be necessary is basically a losing=20 >>> proposition -- you'd need a crazy triangle density.) >>> >>> >>> >>> ------------------------------------------------------- >>> This SF.Net email is sponsored by BEA Weblogic Workshop >>> FREE Java Enterprise J2EE developer tools! >>> Get your free copy of BEA WebLogic Workshop 8.1 today. >>> http://ads.osdn.com/?ad_id=3D5047&alloc_id=3D10808&op=3Dclick >>> _______________________________________________ >>> GDAlgorithms-list mailing list >>> GDAlgorithms-list@... >>> https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list >>> Archives: >>> http://sourceforge.net/mailarchive/forum.php?forum_id=3D6188 >>> >>> =20 >> >> >> >> >> ------------------------------------------------------- >> This SF.Net email is sponsored by BEA Weblogic Workshop >> FREE Java Enterprise J2EE developer tools! >> Get your free copy of BEA WebLogic Workshop 8.1 today. >> http://ads.osdn.com/?ad_idP47&alloc_id=10808&op=CCk >> _______________________________________________ >> GDAlgorithms-list mailing list >> GDAlgorithms-list@... >> https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list >> Archives: >> http://sourceforge.net/mailarchive/forum.php?forum_ida88 >> >> =20 >> > > > > ------------------------------------------------------- > This SF.Net email is sponsored by BEA Weblogic Workshop > FREE Java Enterprise J2EE developer tools! > Get your free copy of BEA WebLogic Workshop 8.1 today. > http://ads.osdn.com/?ad_idP47&alloc_id=10808&op=CCk > _______________________________________________ > GDAlgorithms-list mailing list > GDAlgorithms-list@... > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_ida88 > ```