Sorry your browser is not supported!

You are using an outdated browser that does not support modern web technologies, in order to use this site please update to a new browser.

Browsers supported include Chrome, FireFox, Safari, Opera, Internet Explorer 10+ or Microsoft Edge.

Author
Message
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 21st Feb 2011 02:33 Edited at: 21st Feb 2011 14:21
Hi all, I have a few questions/looking for advice on a few things. So cheers in advance.

The System
Firstly, let me explain my particle system cause it's not the norm, well round here anyway. My system works exactly like 3ds max particle flow (with more functionality since it's tailored to games), or you could call it an event based particle system. For instance, the throwing of a grenade, to it hitting the floor, bouncing, exploding and leaving a decal could all be done with a single particle emitter/system.

So that's the system, now for the first question.

Spawn Particle
What's the best method for spawning a particle? For example, if we did it by rate per second, my method is checking the difference between frames. The advantage is I don't need to store anything about the spawning of particles, just use the emitter elapsed and birth rate, so:



So any idea's guys, does this method work fine or does it need improving?

Attached an example(750KB) of an event with in my particle system. The colour change is due to the event it's in.
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 21st Feb 2011 14:18 Edited at: 21st Feb 2011 14:18
Particle Spawn Position/Direction

Quick look at the system again:

Super Emitter - the root emitter
Source Emitters - child emitters of the Super Emitter
Particle spawn from the child emitters

So the Super Emitter controls the overall position/orientation of it's child emitters. So what needs to be done is to work out the offset position/rotation of the child emitters, then do the same thing for their particles on spawn, works similar to limbs. The only way I know (purely maths I'm talking about) is playing around with forward/up and right vectors. But this is not efficient. So any ideas?
revenant chaos
DBPro Master
19
Years of Service
User Offline
Joined: 21st Mar 2007
Location: Robbinsdale, MN
Posted: 22nd Feb 2011 04:48
Quote: "The only way I know (purely maths I'm talking about) is playing around with forward/up and right vectors. But this is not efficient. So any ideas?"
I know it is generally frowned upon, but perhaps you could use multi-limbed "dummy" objects, where each limb's position/rotation represents an Emitter and the object as a whole represents the "Super Emitter".
Neuro Fuzzy
19
Years of Service
User Offline
Joined: 11th Jun 2007
Location:
Posted: 22nd Feb 2011 16:14
I agree with revenant chaos. I tried to make a transformation program for you but I did something wrong... not sure what though...

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 22nd Feb 2011 22:03
Well that's what I did revenant chaos, but it didn't seem the best way to me. So I thought there must be a better way. I know I could do it with Vector/Quaternions, Eular would be a joke, shouldn't be that hard to make a class. To work out the direction vectors you could do this:



Or how I did it:



I was playing around with them, got stuck when it came to combined rotation of the source to it's super, example:

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 24th Feb 2011 15:26 Edited at: 24th Feb 2011 15:27
And the limb method:


The limb method works well, but having to have a dummy object is a pain, but maths vs limbs for something like this, I guess limbs win. Limbs are really fast. I'm going to have a bash at Quaternions/Matrix math before I give up.
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 25th Feb 2011 22:13 Edited at: 25th Feb 2011 22:13
Ok, working out position and rotation of a spawned particle isn't as easy as I thought. There doesn't seem to be a very efficient way of doing this. But i'll keep trying. So next question.

How do you apply Forces

I can't work out how to apply a force correctly. For instance, how would you apply gravity if this is the update process:

inc Pos, Vel * Delta + .5 * Acc * Delta * Delta
inc Vel, Acc * Delta
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 3rd Mar 2011 15:21 Edited at: 3rd Mar 2011 15:24


Well I got gravity working I think using limbs of a dummy mesh for the direction.
If it's working correctly I should be able to recreate some effect.

Things to work on:

- Generate emitters on collision. Basically when and object falls and hits something, there should be a particle effect at collision points.

- Force based generated emitters. So when sufficient force acts on an objects, emitters are generated round it. The idea being, if you were in some ruins and wind/explosion started to blow, all the dust on objects would be blown off.

- Generated path emitters. Like path finding for AI, but with particles. If there's a fire in a building, I want the smoke to move along corridors and etc...

- Catch and Release particles. So I can dump parts of a level in a emitter and get it to act like a particle before releasing from the emitter. So if you can imagine, you had a crate sitting on the floor and gravity switched, I can get the particle system to handle it. (This already works, I'll make a demo showing what I mean)

There's a ton more stuff but these are the main ones.

Question: What would be cool to see a particle system do?
Van B
Moderator
23
Years of Service
User Offline
Joined: 8th Oct 2002
Location: Sunnyvale
Posted: 3rd Mar 2011 16:07
Quote: "- Generated path emitters. Like path finding for AI, but with particles. If there's a fire in a building, I want the smoke to move along corridors and etc..."


Sounds cool, maybe have the fire spread depending on materials too, like automated spreading fire. I think it would be great to have the fire confined to an expanding area, and that area might be a particle emitter, but with the particles spawning from each other, and constantly updating the shared area. Then, if you have a closed door, a fire might fill a whole room, and when it's time to spawn another fire particle, check to see if there is space for it (maybe a range check within the spawn area) - and if there's not enough space, that's 1 fire particle that area is owed. Then, when something nearby that area changes, like the door opening - spawn all the waiting particles. That way, the fire would rush out of the door, as if starved for oxygen.

Maybe the 'owed' particles would work for the settled dust idea too - so a wall might have an emitter attached to it, and a limited number of dirt particles - but really you'd only track that particle count and use new spawn locations each time.

One effect I do like, is that real cheap rain splosh - if you had an emitter attached to the camera say, and gave it 100 or so rain splosh particles, just position then randombly on the ground in range of the camera. It's possible to get a great and realistic effect of rain by doing that, and adding dropping rain sheets (like big plains, textured with streaks of rain). With fog, the ground splashes, and the rain sheets, you'd have an awesome rain effect.

I find that particles in commercial games have gotten prettier, but not much more than that. I'd like to see smoke gather in the ceiling, fire act more like fire (Farcry2 did a decent job IMO), and just some more dynamic particles. Even subtle effects could make a big difference.

Also, what about super-intelligent particles?
By todays standard, an intelligent particle might move according to the geometry around it, might react with wind, physics etc etc. But by super-intelligent, you could factor in the player position and do some neat effects. For example, in a game I made a while ago, I had these lanterns, and moths flying around them. The moths were a single image, scaling real quick to give the impression of wings flapping. They would loop around quite organically, and if the player smashed their lantern, they chase the player, who can punch them and turn them to a little puff of dust. The moths are just particles, they react to collision, and try to stay with a parent object (lantern or player), so it's really basic AI, but for an insect that is maybe 7 pixels wide at best, it's plenty. By hijacking my particle system to do that, I was able to get it working in under an hour.

Health, Ammo, and bacon and eggs!
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 3rd Mar 2011 17:17 Edited at: 3rd Mar 2011 17:18
Quote: "Also, what about super-intelligent particles?"


Well my particle system is event based, meaning an action in a event could be a test argument, for instance, test if the player is with in a certain range of a particle. If yes the particle gets fired into the tests output event where I could get it to do anything. Like if there was a virus floating around and you got near it. It could go on the attack. All this could be handled by a single emitter.

I think I'll make a demo, like a sort of test chamber (Portal-esque) with buttons you can press to set off some effects. That way we can see what it looks like.
thenerd
17
Years of Service
User Offline
Joined: 9th Mar 2009
Location: Boston, USA
Posted: 3rd Mar 2011 20:37
I would like to see the ability to have particles collide with objects in the environment.

also, are you planning on releasing the code once you finish this?

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 3rd Mar 2011 20:50
Quote: "also, are you planning on releasing the code once you finish this?"


Unfortunately not, it's going to be specific to my engine. But I want to write a tutorial/discussion thread about super emitter type particle systems.
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 4th Mar 2011 03:26 Edited at: 4th Mar 2011 03:27
Here's one particle effect so far:
thenerd
17
Years of Service
User Offline
Joined: 9th Mar 2009
Location: Boston, USA
Posted: 4th Mar 2011 03:55
Very nice.
I've been working some on my own particle system, and I have a question. I'm using an array to store the positions and velocity as well as the other data for each particle in the environment, but no matter how big the array is, it gets filled up too quickly to be able to really use the system. How do you keep track of the particles, in an array or somewhere else, so that you can have as many as you want?

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 4th Mar 2011 05:51 Edited at: 4th Mar 2011 06:07
Well at the moment I'm just using an array, but I'm using linked lists for efficiency(parent child relationships) when it comes to handling them, but I'm going to also add a seed value so I can just calculate where everything is or how something looks. That way, I don't need to store any particle data.

I also have LOD built into the particle systems, because there's no need for so many particles a mile off.

The main issue isn't the storing of data, but the drawing of the particles. As you know DBP can't handle a hugh numbers of objects, so we have to get clever. If you want tons of particles then look into Point Sprites, though there shader based.

Quote: "Very nice."

Cheers. That effect was very easy to setup, pretty much just this:

Duke E
17
Years of Service
User Offline
Joined: 10th Mar 2009
Location:
Posted: 4th Mar 2011 08:33
Hi Sasuke and guys.

My first particle system used the array approach, one particle / index. Every update you have to loop trough the particle array and apply the transformations. Ran in to a CPU limit at 1000 particles before the particle system surpassed the game code in CPU usage. With like 30 different transform parameters, gravity, size changes and so on there are alot of calculations to apply for each particle in the array. Tried using a time skipping method to update particles at a lower framerate with some success.

Quote: "The main issue isn't the storing of data, but the drawing of the particles."

This is quite true, much of the CPU time is dedicated to the pointing of planes (if you use planes) towards the camera and so on.

The limb/particle approach looks interesting, i would like to see more. Is it using DBPro "lock vertexdata for mesh" and
do you use the limbs for positioning purposes only and apply a particle at the position after transformations?

Just putting the finishing touches to a demo so i can post the code for my all GPU point sprite particle system. Runs everything in shaders and takes a minuscule amount of CPU, posted about it in "Learning to write shaders".

Regards
Duke
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 5th Mar 2011 18:00 Edited at: 5th Mar 2011 18:04
Another Demo:


Quote: "The limb/particle approach looks interesting, i would like to see more. Is it using DBPro "lock vertexdata for mesh" and
do you use the limbs for positioning purposes only and apply a particle at the position after transformations?"


For the moment, I'm using limbs, for positioning, plus 3d math for the direction vectors. I was just going to vertexdata commands to see which method is better.

Quote: "much of the CPU time is dedicated to the pointing of planes (if you use planes) towards the camera and so on."


I use tri's (the fastest I guess), planes, anything.

Quote: "Runs everything in shaders and takes a minuscule amount of CPU"


I'm trying to work out how to do this with an event based super intelligent particle system. But I want a CPU system anyway for less particle intensive games/shaderless based games.
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 8th Mar 2011 01:58 Edited at: 8th Mar 2011 01:59
Orbit Spline
Yep, this one's got me confused. I can orbit a point, I can orbit points on a spline, but I can't work out how to orbit all over the spline, for instances, if a particle was moving along it, it would orbit it in the directions it's going until it hits the end of the spline or it's forward velocity isn't enough to keep moving forward.

So basically it can orbit a spline why moving along it, that's where I'm stuck. So any thoughts on this?
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 13th Mar 2011 23:05
Now your playing with particles...


Fire Room
I thought of an idea for fires in rooms and came up with fxVolumes. You set up a volume and give a max mass it can hold. And particle that goes into it, adds it's mass to the volume. There are a number of settings to make it work like fluid and there are a number of bugs as well but I should get it work. The fxVolume works by adding actions to it like a script. So something like, if particle mass < 0.5 do something. This way I can control how particles (or anything) move within the volume.
BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 14th Mar 2011 16:01
Very Impressive!
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 14th Mar 2011 21:16 Edited at: 14th Mar 2011 21:17
Cheers BillR

Just for a quick test vid. Tell me what you'd like to see my particle system do and I'll make a vid doing it.
thenerd
17
Years of Service
User Offline
Joined: 9th Mar 2009
Location: Boston, USA
Posted: 14th Mar 2011 21:51
I would like to see particles colliding and moving around a cube or other object.

Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 21st Mar 2011 17:26
Quote: "I would like to see particles colliding and moving around a cube or other object."


Working on it.

What's the best method for working out how to Orbiting a point?
BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 22nd Mar 2011 10:05 Edited at: 22nd Mar 2011 10:11
1) I have always loved fireworks!
As the fireworks shell explodes high in the air, the main Particles become emitters leaving a trail of particles behind each main particle as they spread apart

2) Will we get a chance to Buy or Play with your great new particle engine?
Sasuke
20
Years of Service
User Offline
Joined: 2nd Dec 2005
Location: Milton Keynes UK
Posted: 22nd Mar 2011 13:28 Edited at: 22nd Mar 2011 13:31
Quoting myself again,

Quote: "Unfortunately not, it's going to be specific to my engine. But I want to write a tutorial/discussion thread about super emitter type particle systems."


Another thing to add is my engine doesn't work like a standard engine. Where most engines are modular and your told that's the way they should be maybe I found tons of stuff not being used. So I created a linked semi modular engine where everything is connected to what I call Directors.

Directors are active, so anything attached to it is active. For example, particles do nothing unless their attached to the fxDirector. So you could say active particles are a child of the fxDirector. The reason I made it like this is to eliminate active checks, I don't need to check if it's active, just update it. There's a Director for every part of the engine, but Directors work exactly the same as particles do, they do nothing unless there attached to the masterDirector which controls the whole system. I made it this way so I could remove Directors from the system. Because I see no point in updating say Sound if there is no Sound at this point in the game. But what also it allows me to do, is have more than one type of Director. So I could have two fxDirectors that I could switch out at any time and get the particles systems to update in a completely different way. I made it this way so I can change elements of the engine on the fly.

Pretty much everything works and updates in this way in my engine, so I would be difficult to rip the particle system out of it. But I could show you how to make your own event based system, something you can work off for anything really.

@BillR, I believe you emailed me, but cause I have like six email accounts I missed it sorry. I'll make a demo where you can play/create your own particle effects using a gui based approach. I'll be using an updated version of my steam gui, so look forward to that. Pic of old:



New GUI is much more prettier.
BillR
23
Years of Service
User Offline
Joined: 19th Mar 2003
Location: United States
Posted: 23rd Mar 2011 08:30
Cool, I look forward to using it!

Login to post a reply

Server time is: 2026-07-16 23:19:11
Your offset time is: 2026-07-16 23:19:11