Re: [Algorithms] Depth-Sorting Axis-Aligned Boxes
Brought to you by:
vexxed72
|
From: metanet s. <met...@ya...> - 2009-08-03 04:06:03
|
I've attached an example demonstrating what I'd like to achieve: the scene is made of 9 faces (3 objects of 3 faces each), a green box resting on a red "desk", underneath which there's a blue box. As far as I can tell there's no sorting function based on camera-space position which works. Then again I'm a bit unclear about what camera-space is exactly for this type of parallel projection, since AFAICT the "camera" is a plane rather than a point (or, camera space is a cube rather than a frustum). It's tempting to say "just sort along z, then y, then x" or something like that, but for such functions there are cases where it does the wrong thing. For instance it seems like sorting the faces based on the distance from their front-upper-right corner to the front-upper-right corner of the cameraspace cube might work, but it doesn't: all three green faces should appear in front of the top red face, but the top red face's corner is closer. Is it even correct to choose a single point to represent the depth of a polygon? It seems like that alone is going to cause problems when there are polygons which extend across a wide range of depths.. Sorry if this is totally stupid and I'm missing something obvious! thanks again, raigan --- On Sun, 8/2/09, Sebastian Sylvan <seb...@gm...> wrote: > From: Sebastian Sylvan <seb...@gm...> > Subject: Re: [Algorithms] Depth-Sorting Axis-Aligned Boxes > To: "Game Development Algorithms" <gda...@li...> > Cc: ra...@ha... > Received: Sunday, August 2, 2009, 6:18 PM > > > On Sun, Aug 2, 2009 at 8:30 PM, > Richard Mitton <mi...@tr...> > wrote: > > I may be missing something, but can't you just do a > sort based on their > > furthest point along the camera axis? > > > > i.e. transform into view space, then sort by furthest Z > coordinate. > Also, the closest corner of the AABB will be the > same for every AABB, so you can just look at the camera > direction once per frame, and compute which "corner > index" you need to check for each AABB. > > -- > Sebastian Sylvan > +44(0)7857-300802 > UIN: 44640862 > > > -----Inline Attachment Follows----- > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal > Reports 2008 30-Day > trial. Simplify your report design, integration and > deployment - and focus on > what you do best, core application coding. Discover what's > new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > -----Inline Attachment Follows----- > > _______________________________________________ > GDAlgorithms-list mailing list > GDA...@li... > https://lists.sourceforge.net/lists/listinfo/gdalgorithms-list > Archives: > http://sourceforge.net/mailarchive/forum.php?forum_name=gdalgorithms-list __________________________________________________________________ Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your favourite sites. Download it now http://ca.toolbar.yahoo.com. |