Hi Robert,

It's hard to describe but I'll give it a shot.  When using osgviewer,
the world coordinate system is Z up.  You can see that by looking at the
modelview matrix in ParticleSystem.  When
ParticleSystem::single_pass_render calls Particle::render the rotation
matrix, R, in render is designed for a coordinate system of Y up.  It's
trying to rotate the particle's quad about the local Z axis.  It's
because the modelview matrix was not applied before single_pass_render
was called that these two coordinate systems are the same.  The local
coordinate system should have been rotated by the modelview matrix.  The
billboard rotates about osgviewer's Z axis (perpendicular to the camera
near plane).  If the modelview matrix had been applied, the quad
rotating about the local Z axis would be parallel to the camera near
plane.

In an application like VTP (where I think Y is up) the particles should
rotate correctly.  Perhaps Ben Discoe can verify that.

If you can apply the modelview matrix to the rotation matrix R in
Particle::render that may solve the problem.


> -----Original Message-----
> From: Robert Osfield [mailto:[email protected]] 
> Sent: Wednesday, December 17, 2008 11:50 AM
> To: OpenSceneGraph Submissions
> Subject: Re: [osg-submissions] Particle 
> systemsetInitialRotationalSpeedRange()
> 
> HI Tom,
> 
> The original changes back in March were there for a reason 
> (to handle world scale effects), and the new code was meant 
> to handle the billboards wihthout needing to reset the 
> modelview matrix.  I'm currently reviewing the code and the 
> SmokeBox.osg example, but as yet haven't spotted where the 
> bug might lie.
> 
> BTW, I don't know what relevance the orientation of X,Y,Z has 
> as, and hence why you mention it, as in theory a billboard 
> will just rotate to be parallel to cameras near plane.  Is 
> there something specific that made you mention this?
> 
> Robert.
> 
> On Wed, Dec 17, 2008 at 2:36 PM, Jolley, Thomas P 
> <[email protected]> wrote:
> > Hi Robert,
> >
> > Trying this again on osg-submissions.
> >
> > I found time to look at this problem.  What you had usually 
> won't work 
> > because the rotation applied in Particle::render doesn't 
> always match 
> > what is going on in ParticleSystem::single_pass_render.  It 
> may work 
> > for applications where Y is up, X is to the right, and Z is 
> toward the 
> > viewer like VTP.  I'm not sure how to fix it other than 
> reversing most 
> > of the r7961 changes.
> >
> > I've enclosed a modified ParticleSystem.cpp with some of the r7961 
> > changes you made in single_pass_render.  It looks like 
> there is a typo 
> > in calculating yAxis.  I think it should be scaleY*scaleY 
> instead of 
> > scaleX*scaleY.  Since I'm not sure what you were trying to do with 
> > this I left that part the way you had it.
> >
> >  <<ParticleSystem.cpp.gz>>
> >
> > _______________________________________________
> > osg-submissions mailing list
> > [email protected]
> > 
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscene
> > graph.org
> >
> >
> _______________________________________________
> osg-submissions mailing list
> [email protected]
> http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-o
> penscenegraph.org
> 
_______________________________________________
osg-submissions mailing list
[email protected]
http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscenegraph.org

Reply via email to