Enhancement: Particles

Discussion area about developing or extending OGRE, adding plugins for it or building applications on it. No newbie questions please, use the Help forum for that.
Post Reply
User avatar
OGRE Team Member
OGRE Team Member
Posts: 3589
Joined: Sat Jul 21, 2007 4:55 pm
Location: Buenos Aires, Argentina
x 87

Enhancement: Particles

Post by dark_sylinc » Wed Mar 14, 2012 9:12 pm

This time is a small enhancement. But again, it's a very powerful one. ParticleUniverse had something similar but I found it very unflexible. Plus, in this project I'm working on, I don't have PU.
Particle emitters now have the "direction_position_reference" parameter.

From the manual:

Code: Select all

format: direction_position_reference <x> <y> <z> <enable>
example: direction_position_reference 0 -10 0 1
default: direction_position_reference 0 0 0 0
Use 1 to enable, 0 to disable.

When enabled, the direction of particles is calculated as (positionReference - positionOfParticleAtEmission).
This image ilustrates the case in 2D:
This is excellent for simulating explosions (velocity > 0) or implosions (velocity < 0) when the position reference is in the center. Without this enhancements, one could do this with point emitters setting angle to 180; however when using other types of emitters (Ellipsoid, box, ring, etc) this was a seemingly impossible task because the direction was completely random at angle 180, rather than being consistent to a single point of origin, or "source".

When the position ref. is below the emitters, it can be used to simulate dust stomps in the ground. I've made one in my own game that looks amazing (can't share the picture yet, sorry guys; demo was submitted to Intel Level Up contest).
When position ref. is on the side of the emitters, it can be used for simulating wind coming from a fan.

I hope you enjoy it.
Dark Sylinc

PS: I thoroughly tested this enhancement as I wrote it a month ago, but just submitted right now.

Your PU system will probably need a few small changes in order to compile again. Changes are really small so it shouldn't be much of a problem. Basically "genEmissionDirection" now requires a second additional parameter, containing the particle's position.
0 x

User avatar
Posts: 195
Joined: Thu Jan 13, 2005 2:35 pm
Location: Tampere, Finland

Re: Enhancement: Particles

Post by fractile » Sat Apr 30, 2016 11:12 am

Where is this documented? At least not here: http://www.ogre3d.org/docs/manual/manua ... Attributes

I have been struggling with particle effects for years not knowing something like this exists. This makes everything so much easier!
0 x

Post Reply