Hi Robert, I've moved this discussion over to osg-users.
Attached are some examples that should show the precision problem I'm running into. There are 4 osg files. The first one, particle.osg, is just a plain particle effect emmitting smoke. The other osg files are based on this model. The second file, particle_move_6M.osg, is the particle.osg with the top group node replaced by a MatrixTransform with it's X translation set to 6000000. From your previous email I think you didn't expect the particles to stay with the rest of the geometry. With the September change to ModularEmitter.cpp there are three transformations on a particle instead of two. Notice how the particles move with the MatrixTransform instead of the world coordinate system. Some may want this effect while others wouldn't. For smoke like this I think the particles should stay in the world coordinate system once emitted. The third example, particle_move_6M_new_code.osg, is the particle.osg modified as I had described below (in my last email) for the September code change. You will need to press the space bar in osgviewer to see the model. You should notice how the particle effects are not smooth due to precision problems. What isn't observable is the direction particles are emitted also have precision problems. Notice how the particles, once emitted, operate in the world coordinate system. The fourth example, particle_move_6M_old_code.osg, is designed to work with ModularEmitter before the September change. This is also described below. Particle effects are smooth since the precision issues are taken care of by the double precision in MatrixTransform. Also, Particles, once emitted, operate in the world coordinate system. ---- Tom Jolley > -----Original Message----- > From: Jolley, Thomas P > Sent: Thursday, April 23, 2009 11:17 AM > To: OpenSceneGraph Submissions > Subject: Re: [osg-submissions] osgParticle > ParticleSystemandModularEmitterin different coordinate systems > > Hi Robert, > > > -----Original Message----- > > From: Robert Osfield > > > > Hi Tom, > > > > I wouldn't expect the cessnafire.osg model to work under a moving > > MatrixTransform, this is a known attribute of osgParticle - > you have > > to move the ParticleSystem outside of any moving models, you can't > > leave it from within the moving subgraph otherwise the > particles get > > transformed twice. > > This is how it worked before the September change. With the > change it sort of works under a MatrixTransform. The change > seems to undo any MatrixTransforms above the particle system. > I don't know enough about what Tim was trying to correct but > it looks almost like "fixing" this attribute of osgParticle. > > > > > The osgparticleeffects example illustrates how to handling moving > > models and particle systems. > > I'll take a closer look at this example. I'll see if I can > come up with some examples that demonstrate the problem I'm > running into. > > > > > In your own case I don't know what to make of the issues, > could it be > > that you aren't constructing your particle system appropriately for > > moving models, or is it that you have a genuine precision > issue that > > is unrelated to the moving model issue? Tim's submission > was intended > > to address some of the precisions issues, so it's > disappointing that > > in some usage case it might have made things worse. Reverting this > > change would break the problem Tim was trying to solve > though, so I'm > > very reluctant to do this without clear illustration of > problems and a > > solution that addresses both the issues you are seeing and the ones > > that Tim was seeing. > > My construction and rearangement of a model like > cessnafire.osg worked just fine before the September change. > I had no particle placement or precision issues precisely > because of how I rearanged the model and added additional > MatrixTransforms above the ModularEmitters and Geodes with > Particles. I suppose a picture is worth a thousand words. > > Original graph > > Group -+ > | > +--Geode of main Body > | > +--Modular Emitter > | > +--Geode for particles > | > +--ParticleSystemUpdater > > Modified graph > > Group--+ > | > +--MatrixTransform 1--+ > | | > | +--Geode of main Body > | > +--MatrixTransform 2--+ > | | > | +--Modular Emitter > | > +--MatrixTransform 3--+ > | | > | +--Geode for particles > | > +--ParticleSystemUpdater > > With the modified graph I set the model position and attitude > with MT1. I set MT3 to a translation where the model will be > used and do not update it. MT2 uses the rotation of MT1 and > the translation is set to MT1's translation minus MT3's > translation. This keeps everything well withing single > precision values and avoids the known attibute of osgParticle > you described above. > > With the September change I need to modify the original model > as follows: > > Group--+ > | > +--MatrixTransform 1--+ > | | > | +--Geode of main Body > | | > | +--Modular Emitter > | > +--Geode for particles > | > +--ParticleSystemUpdater > > Because the ModularEmitter is now doing a transformation on > particles, MT2 would be the same as MT1 from before. MT2 > goes away and just put the ModularEmitter under MT1. Since > the ModularEmitter is now creating particles in world > coordinates, MT3 is no longer needed. However, because the > translation in MT1 can be so large for geocentric > coordinates, precision is lost with Particles only being > single precision. > > I think the bottom line is the ModularEmitter is now doing > the work of a MatrixTransform on particles in single precision. > > I agree with you that we need to be careful of reverting the > change. I don't know enough about the problem Tim was trying > to overcome to even suggest a solution that can meet both problems. > > > > > Unfortunately not being the original author of osgParticle I don't > > have a 100% clear picture of the internal implementation so am > > effectively in the same boat as everyone else - I just have to read > > the code and try and make sense of it. > > > > Robert. > > > > On Wed, Apr 22, 2009 at 6:35 PM, Jolley, Thomas P > > <[email protected]> wrote: > > > Hi Robert, > > > > > > A little late but I just noticed this change has broken particle > > > effects in my application. When I tried to change my > > application to > > > work with this change I get problems with floating point > > precision on > > > the particles. I don't think this change is the correct > > solution for > > > fixing floating point precision problems with particle > > effects. It's > > > better done at the application level by separating out > non-particle > > > system nodes, particle processors, and the geodes where > > particles are placed. > > > An appropriate MatrixTransform can be placed above each new > > graph to > > > resolve the precision issues for the particular frames of > reference. > > > Perhaps Tim Moore can explain further the problem he was > > trying solve > > > by giving us an example. > > > > > > Here are some examples of how this change looks like it > > might work and > > > how it doesn't work using the cessnafire.osg model. > > > > > > 1. How it looks like it might work. Load the > cessnafire.osg model > > > and put it under a MatrixTransform. Using the > > MatrixTransform, move > > > the model to about 6M meters. Watch the particle effects > when the > > > model is slowly translated using the MatrixTransform. The > > precision > > > of the particles look good. The particles are emitted from the > > > correct location from the model. The particles once > > emitted move with > > > the MatrixTransform when they should stay fixed to the world > > > coordinate system. > > > > > > 2. How it doesn't work. Load the cessnafire.osg model > and put it > > > under a MatrixTransform. Put the MatrixTransform under a > > Group. Move > > > the Geodes where particles are placed so that they are > > under the top > > > Group node. You may as well move the ParticleSystemUpdater > > under the > > > top Group node. Moving the model out to 6M meters and slowly > > > translate the model using the MatrixTransform. The > > precision of the particles is bad. > > > The particles are emitted from the correct location but > > possibly the > > > wrong direction due to precision problems. The particles > > once emitted > > > stay fixed to the world coordinate system as I would expect. > > > > > > > > > -----Original Message----- > > > From: Robert Osfield [mailto:[email protected]] > > > Sent: Thursday, September 18, 2008 5:12 AM > > > To: OpenSceneGraph Submissions > > > Subject: Re: [osg-submissions] osgParticle ParticleSystem and > > > ModularEmitterin different coordinate systems > > > > > > Thanks Tim, I've merged your changes, and also added a > > > Drawable::getWorldMatrices(const Node*) method and tweaked > > your code > > > to use this rather than needing to use getParents(0) and then > > > getWorldMatrices() as getParents(0) could in theory be null > > (although > > > in a correctly set up scene it won't be). > > > > > > Could you do an svn update and test out my changes, Robert. > > > > > > On Wed, Sep 10, 2008 at 9:39 AM, Tim Moore > > <[email protected]> wrote: > > >> Hello, > > >> This submission fixes a bug when the ModularEmitter and > > >> ParticleSystem > > > > > >> are in different frames of reference. Specifically, it > > supports the > > >> case where the ParticleSystem is not in the world frame. > > One way this > > >> can come up is if your world coordinate system is > > Earth-centric; the > > >> float coordinates of particles don't have enough precision > > to avoid > > >> terrible jitter and other rendering artifacts, so it's > > convenient to > > >> root the particle systems in a local Z-up coordinate > > system that gets > > > moved around from time to time. > > >> > > >> I haven't touched the rotation and angular velocity properties of > > > particles. > > >> IMHO they are pretty broken, dealing in Euler angles and > > such, and I > > >> see that they aren't used in the rest of the particle > system code. > > >> > > >> Tim > > >> > > >> _______________________________________________ > > >> osg-submissions mailing list > > >> [email protected] > > >> > > > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscen > > >> e > > >> graph.org > > >> > > >> > > > _______________________________________________ > > > osg-submissions mailing list > > > [email protected] > > > > > > http://lists.openscenegraph.org/listinfo.cgi/osg-submissions-openscene > > > gr > > > aph.org > > > _______________________________________________ > > > 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-o > penscenegraph.org >
particle_precision.tar
Description: particle_precision.tar
_______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

