OpenSceneGraph Forum Forum Index OpenSceneGraph Forum
Official forum which mirrors the existent OSG mailing lists. Messages posted here are forwarded to the mailing list and vice versa.
 
   FAQFAQ    SearchSearch    MemberlistMemberlist    RulesRules    UsergroupsUsergroups    RegisterRegister 
 Mail2Forum SettingsMail2Forum Settings  ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
   AlbumAlbum  OpenSceneGraph IRC ChatOpenSceneGraph IRC Chat   SmartFeedSmartFeed 

particle speed in OSG Particle Effects


 
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General
View previous topic :: View next topic  
Author Message
Trajce Nikolov NICK
Guest





PostPosted: Sun Oct 25, 2015 5:54 pm    Post subject:
particle speed in OSG Particle Effects
Reply with quote

Hi Community,


I am trying to work with the sample particle effects, and to change their speed. I thought it is enough to change the default particle template velocity, but whatwever I do it seams it has no effect. Here is some snippet of my approach. Anyone with hint? Thanks a bunch as always


osg::ref_ptr<osgParticle::ParticleEffect> effect;
effect = new osgParticle::SmokeEffect(osg::Vec3(0, 0, 0), scale, intensity);
osgParticle::Particle& particle = const_cast<osgParticle::Particle&>(effect->getDefaultParticleTemplate());
particle.setVelocity(osg::Vec3(0, 0, particleSpeed));



Nick


--
trajce nikolov nick

------------------
Post generated by Mail2Forum
Back to top
scrawl
Appreciator


Joined: 14 Dec 2014
Posts: 175

PostPosted: Sun Oct 25, 2015 6:25 pm    Post subject:
Reply with quote

Hi Nick,

the particle template's velocity isn't used, it's the particle emitter that determines initial particle velocity. Have a look at the ModularEmitter / Shooter classes in osgParticle.

If you wanted to globally make particles simulate faster (as in a time lapse) you could just change the osg simulationTime to run faster.
Back to top
View user's profile Send private message
Trajce Nikolov NICK
Guest





PostPosted: Sun Oct 25, 2015 6:39 pm    Post subject:
particle speed in OSG Particle Effects
Reply with quote

Hi Jannik,

thanks for the hint. Here is what I see in ModularEmitter:




On Sun, Oct 25, 2015 at 7:25 PM, Jannik Heller < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
Hi Nick,

the particle template's velocity isn't used, it's the particle emitter that determines initial particle velocity. Have a look at the ModularEmitter / Shooter classes in osgParticle.

If you wanted to globally make particles simulate faster (as in a time lapse) you could just change the osg simulationTime to run faster.

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





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org




--
trajce nikolov nick

------------------
Post generated by Mail2Forum
Back to top
Trajce Nikolov NICK
Guest





PostPosted: Sun Oct 25, 2015 6:40 pm    Post subject:
particle speed in OSG Particle Effects
Reply with quote

Wops, too fast .. Pressed wrong keys

void osgParticle::ModularEmitter::emitParticles(double dt)

....
Particle* P = getParticleSystem()->createParticle(getUseDefaultTemplate()? 0: &getParticleTemplate());
            if (P)
            {
                _placer->place(P);
                P->setPosition(P->getPosition() * worldToPs);
                _shooter->shoot(P);
                P->setVelocity(osg::Matrix::transform3x3(P->getVelocity(),
                                                         worldToPs));


                if (cps) P->setUpTexCoordsAsPartOfConnectedParticleSystem(cps);
            }



On Sun, Oct 25, 2015 at 7:36 PM, Trajce Nikolov NICK < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
Hi Jannik,

thanks for the hint. Here is what I see in ModularEmitter:




On Sun, Oct 25, 2015 at 7:25 PM, Jannik Heller < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
Hi Nick,

the particle template's velocity isn't used, it's the particle emitter that determines initial particle velocity. Have a look at the ModularEmitter / Shooter classes in osgParticle.

If you wanted to globally make particles simulate faster (as in a time lapse) you could just change the osg simulationTime to run faster.

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





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org






--
trajce nikolov nick






--
trajce nikolov nick

------------------
Post generated by Mail2Forum
Back to top
Trajce Nikolov NICK
Guest





PostPosted: Sun Oct 25, 2015 8:14 pm    Post subject:
particle speed in OSG Particle Effects
Reply with quote

Jannik, you were right .. Here is the thing (bellow) .. Thanks a bunch for the pointer !!

inline void RadialShooter::shoot(Particle* P) const
    {
        float theta = _theta_range.get_random();
        float phi = _phi_range.get_random();
        float speed = _speed_range.get_random();
        osg::Vec3 rot_speed = _rot_speed_range.get_random();


        P->setVelocity(osg::Vec3(
            speed * sinf(theta) * cosf(phi),
            speed * sinf(theta) * sinf(phi),
            speed * cosf(theta)
            ));


        P->setAngularVelocity(rot_speed);
    }



On Sun, Oct 25, 2015 at 7:37 PM, Trajce Nikolov NICK < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
Wops, too fast .. Pressed wrong keys

void osgParticle::ModularEmitter::emitParticles(double dt)

....
Particle* P = getParticleSystem()->createParticle(getUseDefaultTemplate()? 0: &getParticleTemplate());
            if (P)
            {
                _placer->place(P);
                P->setPosition(P->getPosition() * worldToPs);
                _shooter->shoot(P);
                P->setVelocity(osg::Matrix::transform3x3(P->getVelocity(),
                                                         worldToPs));


                if (cps) P->setUpTexCoordsAsPartOfConnectedParticleSystem(cps);
            }



On Sun, Oct 25, 2015 at 7:36 PM, Trajce Nikolov NICK < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
Hi Jannik,

thanks for the hint. Here is what I see in ModularEmitter:




On Sun, Oct 25, 2015 at 7:25 PM, Jannik Heller < (
Only registered users can see emails on this board!
Get registred or enter the forums!
)> wrote:
Quote:
Hi Nick,

the particle template's velocity isn't used, it's the particle emitter that determines initial particle velocity. Have a look at the ModularEmitter / Shooter classes in osgParticle.

If you wanted to globally make particles simulate faster (as in a time lapse) you could just change the osg simulationTime to run faster.

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





_______________________________________________
osg-users mailing list
(
Only registered users can see emails on this board!
Get registred or enter the forums!
)
http://lists.openscenegraph.org/listinfo.cgi/osg-users-openscenegraph.org






--
trajce nikolov nick








--
trajce nikolov nick






--
trajce nikolov nick

------------------
Post generated by Mail2Forum
Back to top
Display posts from previous:   
Post new topic   Reply to topic    OpenSceneGraph Forum Forum Index -> General All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum

Similar Topics
Topic Author Forum Replies Posted
No new posts the speed of PagedLOD create nodes snowlove General 0 Thu Sep 20, 2018 8:07 am View latest post
No new posts How to speed up rendering in this case. pwang General 3 Tue Jul 31, 2018 3:00 am View latest post
No new posts osgParticle (particle life time)` Trajce Nikolov NICK General 2 Sat Sep 30, 2017 8:12 pm View latest post
No new posts slow speed of osgDB::writeImageFile()... cbuchner1 General 0 Mon Sep 12, 2016 9:09 am View latest post
No new posts Speed of Shaders danoo General 2 Mon Apr 04, 2016 5:42 am View latest post


Board Security Anti Bot Question MOD - phpBB MOD against Spam Bots
Powered by phpBB © 2001, 2005 phpBB Group
Protected by Anti-Spam ACP