## RE: [Algorithms] 2d clipping of 3d geometry

 RE: [Algorithms] 2d clipping of 3d geometry From: Tom Forsyth - 2001-03-30 19:50:45 ```Yes, I do. I sat down and worked it out once. The maths was grunky, but actually it all factored out to some really trivial stuff (i.e. two offsets, two scales, or something like that). Sadly, it's on my machine at home. I'll try to find it for you over the weekend. Tom Forsyth - Muckyfoot bloke. What's he up to now (and in the past)? http://www.muckyfoot.com/startopia/camgal.html > -----Original Message----- > From: Ratcliff, John [mailto:jratcliff@...] > Sent: 30 March 2001 20:14 > To: 'gdalgorithms-list@...' > Subject: RE: [Algorithms] 2d clipping of 3d geometry > > > Ok, anybody know how to build this magical projection matrix > compatible for > D3D? > > Here's the magical routine I need: > > void BuildMagicalProjectionMatrix(float sx1,float sy1,float sx2,float > sy2,float *matrix) > { > // insert magic here... > // where sx1,sy1 and sx2,sy2 define the screen space we want > to scissor > clip to, normalized in units -1,1 > // matrix is a pointer to a d3d format matrix. > // this magical routine has access to. > // znear, zfar, aspect, fovx, and fovy > // Thanks!! > } > > -----Original Message----- > From: Tom Forsyth [mailto:tomf@...] > Sent: Friday, March 30, 2001 1:00 PM > To: gdalgorithms-list@... > Subject: RE: [Algorithms] 2d clipping of 3d geometry > > > It's usually more efficient to actually change your projection stuff. > Although the scissor rejects pixels fairly early, a lot of > cards still have > to actually rasterise the triangles in some way. Doing real > clipping means > off-screen tris never even get passed to the rasteriser (and > in most cases > the vertices don't get lit, either). Changing your projection > matrix isn't > that big a deal. > > Oh, and the answer's no - there's no direct thing in D3D to > do this. You > only have the viewport. > > Tom Forsyth - Muckyfoot bloke. > > What's he up to now (and in the past)? > http://www.muckyfoot.com/startopia/camgal.html > > > > -----Original Message----- > > From: Ratcliff, John [mailto:jratcliff@...] > > Sent: 30 March 2001 19:35 > > To: 'gdalgorithms-list@...' > > Subject: [Algorithms] 2d clipping of 3d geometry > > > > > > Is there an easy way under DirectX 8.0 to change the 2d clip > > region when > > rendering geometry? I believe under OpenGL this is called > > scissor clipping, > > where you change the 2d clip region, *not* the view port. I > > have been told > > of a hack where you can accomplish this by changing your > > viewport and then > > changing your projection matrix to shear and scale, so that > > the geometry now > > fits into this new viewspace. This is fairly ugly, and I > > would much prefer > > to simply change the 2d clip region. > > > > The reason I want to do this is because in a portal renderer > > you can make a > > new 2d clip region based on where the portal is in screen space and > > accomplish roughly the same thing as user clip planes without > > the penalty, > > or more to the point, the fact that most cards don't really > > support user > > clip planes. > > > > Thanks, > > > > John > > > > _______________________________________________ > > GDAlgorithms-list mailing list > > GDAlgorithms-list@... > > http://lists.sourceforge.net/lists/listinfo/gdalgorithms-list > > > > _______________________________________________ > GDAlgorithms-list mailing list > GDAlgorithms-list@... > http://lists.sourceforge.net/lists/listinfo/gdalgorithms-list > > _______________________________________________ > GDAlgorithms-list mailing list > GDAlgorithms-list@... > http://lists.sourceforge.net/lists/listinfo/gdalgorithms-list > ```

JavaScript is required for this form.

No, thanks