Resending plain text. Apologies for the HTML mail (stupid Outlook.)
Hello, I'm having trouble with osg::ParticleSystem and was hoping someone might have some ideas. I am using OSG 1.2 (as a component of Delta3D 1.5). First, some background. In my application the user is able to switch between multiple views of the map. In the simplest case one view is a top-down orthographic camera, the other view is a normal first-person perspective camera. Because the orthographic camera presents an abstracted map, the views are implemented as different cameras looking out onto different scenes (loaded from different files) and entities are duplicated on each scene (in many cases different graphics are used, with 2D icons in the orthographic view and 3D models used in the perspective view.) I am using particle effects for explosions, smoke and flares. These were created using the particle system editor provided in the Delta3D package, and are saved and loaded from plain osg files. The problem I am having is this: because only one view is active at a time, when a particle system is created on the inactive view, it is never updated. As a result, when user switches views (causing the formally inactive view to become active), the particle systems on the inactive view have to "catch up" -- for example, every pending explosion happens simultaneously (even if explosion should have happened five minutes ago) smoke clouds appear out of nowhere when they should already be thick and billowing, flares that should already be lit light up for the first time, etc. The fundamental problem that I can discern is that this a result of a (questionable?) design decision to tie updating the particle system to the culling pass of the render, instead of part of the "application update" pass. Camera disabled, no cull, no particle system update. I've have yet to find a satisfactory solution to this problem. So far I have tried several different approaches: - Forcing a cull of the inactive views with drawing disabled. This does work, but at a terrible cost to framerate (30 fps to 10) since it is doing a huge amount of unneccessary work culling in addition to the minor job of updating the particle effects. - Forcing an update of the particle system (and particle processors) from application code. This requires hacking the OSG code to disentangle the update logic from the culling visitor, and writing an additional application level pass that goes through the scene looking for particle systems to update. Mysteriously, when I do this the particle systems then don't show up at all (and the drawing function is never called) so I couldn't actually get this approach to work. I presume there is some secret sauce in the culler that determines whether to draw the particle system or not, and updating it outside the culling pass confuses that logic. - Fixing the particle system updater to update in small steps when it "catches up", since part of the problem is that individual particles only have a lifespan of 2-3 seconds, and it is asking the particle system to update in a single 20 second step . Taking smaller steps helps, but ultimately this also doesn't work, for a more subtle reason. The particle system update phase is actually split across several objects that are updated independently, but whose effects are interrelated: the particles system itself which moves the particles and removes old ones, and the emitter, which adds new particles. It doesn't do any good to update the entire timespan of the particles system, *then* update the entire timespan of the emitter, since the newly emitted particles are not updated, and the particles are effectively created at the end of the emitter timespan rather than being evenly distributed. At this point I am at a loss for what to do. This shouldn't be so difficult, yet I've already spent three days banging my head against it. Help! Peter Amstutz Software Engineer General Dynamics Information Technology 508-647-6970 ex 225 [EMAIL PROTECTED] <mailto:[EMAIL PROTECTED]> _______________________________________________ osg-users mailing list [email protected] http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org

