Re: [Plib-users] R: culling problems w/ off-axis projection
Brought to you by:
sjbaker
|
From: Fay, J. F Dr C. U. A. 46 S. <joh...@eg...> - 2010-04-17 16:33:13
|
Paolo,
Congratulations and very good on having solved the problem. Is there a code change that you want me to put into Subversion?
Dr. John F. Fay
Technical Fellow
Jacobs Technology TEAS Group
850-883-1294
-----Original Message-----
From: Paolo Leoncini [mailto:p.l...@ci...]
Sent: Monday, April 12, 2010 3:21 AM
To: 'PLIB Users'
Subject: [Plib-users] R: culling problems w/ off-axis projection
Dear friends,
I think to have solved the problem.
> -----Messaggio originale-----
> Da: p.l...@ci... [mailto:p.l...@ci...]
> Inviato: martedì 6 aprile 2010 11.19
> A: pli...@li...
> Oggetto: [Plib-users] culling problems w/ off-axis projection
>
> Dear all,
>
> I'm doing off-axis projection (the most general form of
> projection) by translating the four corners of the screen
> into a projection matrix, for which I added a new method to
> the sgFrustum class and to the Context too. The only
> difference with giving the six frustum extrema values is that
> no calculation occurs. Culling seems to rely only on the
> projection matrix values, so, apparently, no difference w/
> the on-axis standard case.
>
> As far as the projection is not far from the on-axis case the
> culling gives no problem. Instead when screen position
> definition results in a large rotation in the projection
> matrix objects suddenly disappear and reappear by apparently no rule.
>
> Are culling calculations based on a particular form of the
> projection matrix?
> should culling planes be extracted in a different way to
> support the more general case?
In sgFrustum::contains( const sgSphere *s ) (sg.cxx), the for the non-ortho
case which is presently done this way:
sp1 = plane[ SG_LEFT_PLANE ][0] * center[0] + plane[ SG_LEFT_PLANE
][2] * center[2] ;
sp2 = plane[ SG_RIGHT_PLANE ][0] * center[0] + plane[ SG_RIGHT_PLANE
][2] * center[2] ;
sp3 = plane[ SG_BOT_PLANE ][1] * center[1] + plane[ SG_BOT_PLANE
][2] * center[2] ;
sp4 = plane[ SG_TOP_PLANE ][1] * center[1] + plane[ SG_TOP_PLANE
][2] * center[2] ;
should be substituted by the following general form:
sp1 = sgScalarProductVec3 ( plane[ SG_LEFT_PLANE ], center ) + plane[
SG_LEFT_PLANE ][3] ;
sp2 = sgScalarProductVec3 ( plane[ SG_RIGHT_PLANE ], center ) + plane[
SG_RIGHT_PLANE ][3] ;
sp3 = sgScalarProductVec3 ( plane[ SG_BOT_PLANE ], center ) + plane[
SG_BOT_PLANE ][3] ;
sp4 = sgScalarProductVec3 ( plane[ SG_TOP_PLANE ], center ) + plane[
SG_TOP_PLANE ][3] ;
The hint were just below there (see comment "Note: in the general case, we
would have to do:").
I propose to patch it since this general form also manages the default
on-axis case, but Steve should definitely give the go-ahead.
Should someone be concerned about performances I could supply a bit larger
patch for introducing the ability to supply the Context a general
perspective matrix, so to have the general case only calculated in this
eventuality.
> Thanks a lot,
>
> Paolo Leoncini
Thanks in advance to a good will updater (John, it's you as usual?).
Paolo Leoncini
> --------------------------------------------------------------
> ----------------
> Download Intel® Parallel Studio Eval Try the new
> software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> plib-users mailing list
> pli...@li...
> https://lists.sourceforge.net/lists/listinfo/plib-users
>
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
plib-users mailing list
pli...@li...
https://lists.sourceforge.net/lists/listinfo/plib-users
|