[osg-users] OsgParticle when is the particleSystemUpdater called

ivar out ivarout2 at gmail.com
Wed Aug 15 06:51:10 PDT 2018


Hi,

I have two questions regarding the use of theosgParticle class.
(1) I'm trying to create a plume emitter, though I would like be able to adjust the color and alphaRange of the particle template depending on the viewer that renders it. My first attempt was to update the color range before rendering a frame of the second viewer, using:

Code:

while (!viewer.done())
{
	ps->getDefaultParticleTemplate().setColorRange(osgParticle::rangev4(osg::Vec4(1, 0, 0, 1), osg::Vec4(0, 0, 1, 1)));
	viewer.frame();

	ps->getDefaultParticleTemplate().setColorRange(osgParticle::rangev4(osg::Vec4(1, 1, 0, 1), osg::Vec4(0, 0, 1, 1)));
	viewer2.frame();
}



where ps is the particle system. Though this will only use the first defined color range for both frames. I guess I am failing to understand when exactly the particleSystemUpdater is called. 

(2) I was also wondering why the shape of the emitted plume changes drastically when I increase the timestep per frame. For example, when I create frames at discrete timesteps using the following bit of code, only a small part of the plume will be visible, as if many particles were never created, or killed too soon.:

Code:

double simulationTime = 0;
while(!viewer.done())
{
viewer.frame(simulationTime);
simulationTime += 0.1;
}




I'm sorry I'm not too experienced in OSG  :-* . any help would be very much appreciated! :)

Cheers,
ivar [/code]

------------------
Read this topic online here:
http://forum.openscenegraph.org/viewtopic.php?p=74530#74530







More information about the osg-users mailing list