Particle system - not enough particles due to frame rate
Particle system - not enough particles due to frame rate
in my game i have my fighter units have a particle system when they move, like homeworld fighters, but the frame rate can not go above 60, and that causes problems because no matter what number i put for min and max particles per second, i get this effect
the particles are ment to form a solid line, but they are seperated because my fighters move too fast.
How can i make it a smooth line without just increasing the particle size?
Is it even possible?
the particles are ment to form a solid line, but they are seperated because my fighters move too fast.
How can i make it a smooth line without just increasing the particle size?
Is it even possible?
The first thing you could try is to use a ParticleBoxEmitter with a large box size. Increasing the boxsize will distribute the particles over a larger area and maybe this will already be enough to avoid those gaps.
Otherwise it could even get a little more problematic as you don't have the necessary information (positions) within the particle emitters. So you will have to change the CParticleSystemNode itself. The best place would probably be in CParticleSystemSceneNode::doParticleSystem where the new particles are accessible directly after they are spawned. Check if they are global (it's only of interest for those), remember the old position of the node and interpolate somehow between the old and new position.
Actually i tried that also, but didn't get such good results by that. In my experience about 200 particles per second need to be spawned to get a smooth trail no matter how much you interpolate it (for particles as small as needed for a similar looking trail).
Otherwise it could even get a little more problematic as you don't have the necessary information (positions) within the particle emitters. So you will have to change the CParticleSystemNode itself. The best place would probably be in CParticleSystemSceneNode::doParticleSystem where the new particles are accessible directly after they are spawned. Check if they are global (it's only of interest for those), remember the old position of the node and interpolate somehow between the old and new position.
Actually i tried that also, but didn't get such good results by that. In my experience about 200 particles per second need to be spawned to get a smooth trail no matter how much you interpolate it (for particles as small as needed for a similar looking trail).
-
- Admin
- Posts: 3590
- Joined: Mon Oct 09, 2006 9:36 am
- Location: Scotland - gonnae no slag aff mah Engleesh
- Contact:
The trails in homeworld are made up of joined segments of elengated quads, not individual points or billboards. To get anything like the same effect, you'd have to use hundreds of billboards per craft.
It's not something that Irrlicht supports natively, so you'll have to DIY it.
You could use either flat planes that rotate around their Z axes to face the camera (an exercise for the reader), or cross-polys. Each time the craft changes direction, you need to start a segment, and you'll want to fade the tail segments off over time.
It's not something that Irrlicht supports natively, so you'll have to DIY it.
You could use either flat planes that rotate around their Z axes to face the camera (an exercise for the reader), or cross-polys. Each time the craft changes direction, you need to start a segment, and you'll want to fade the tail segments off over time.
Ok i have a new problem, how do i fade out a .3ds animated mesh scene node? That is what i am using for my particles now, it is set to EMF_TRANSPARENT_ADD_COLOR and i tried setting the ambient, diffuse, and emissive colors all to 0 but it remained visible. I can not figure out how to fade it out.
Somehow a particle system fade out affector does it...but looking at the code there all it seems to do is change the color values like i did.
I did a search and found some old stuff on having to use emf transparent vertex alpha, i would prefer not to use that...but do i have to? is there a way to easily set the transparency of a scene node?
And this has to be done on dozens of scene nodes every frame...so is using the mesh manipulator to change the vertex alpha very draining on performance?
thanks,
esaptonor
Somehow a particle system fade out affector does it...but looking at the code there all it seems to do is change the color values like i did.
I did a search and found some old stuff on having to use emf transparent vertex alpha, i would prefer not to use that...but do i have to? is there a way to easily set the transparency of a scene node?
And this has to be done on dozens of scene nodes every frame...so is using the mesh manipulator to change the vertex alpha very draining on performance?
thanks,
esaptonor
no the boxes were particle sprites.
I started trying to make a new one with animated mesh scene nodes (just 2 quads in a cross) because it was easier than creating the quads via code, but then of course i couldn't change the transparency, so now it is all done with code, and i can change the transparency when my new scene node is rendered, so it is all perfect!
And i have had good performance...the frame rate is locked so it can not go higher than 60 frames per second, and the only time it ever went below 59/60 is when i first added my asteroids...and each group had over 10 thousand polygons in it, so of course the scene suddenly had over 100 thousand polygons and the frame rate dropped, but i fixed that easy enough by creating new meshes, and since then performance has been good.
So in short, i dont understand the performance comment.
To sum up: It all works now, thanks for all your help!
I started trying to make a new one with animated mesh scene nodes (just 2 quads in a cross) because it was easier than creating the quads via code, but then of course i couldn't change the transparency, so now it is all done with code, and i can change the transparency when my new scene node is rendered, so it is all perfect!
And i have had good performance...the frame rate is locked so it can not go higher than 60 frames per second, and the only time it ever went below 59/60 is when i first added my asteroids...and each group had over 10 thousand polygons in it, so of course the scene suddenly had over 100 thousand polygons and the frame rate dropped, but i fixed that easy enough by creating new meshes, and since then performance has been good.
So in short, i dont understand the performance comment.
To sum up: It all works now, thanks for all your help!
My map has inconsistancies in it, ie, there is more asteroids in some places than others, and so when you are scrolling around, the amount of polygons on screen can suddenly increase a lot. If vsync is off and i let the frame rate go high anyway, then it can change from 200 down to 80 when some asteroids come on, and this makes things less smooth. It also takes a second or two for irrlicht to get the correct frames per second, so my ships can suddenly slow down for a split second, which just makes things look jerky and less professional (in my opinion).
So to make it all nice and simple i just lock the frame rate to 60. That way all the small changes in frame rate are not a problem.
So to make it all nice and simple i just lock the frame rate to 60. That way all the small changes in frame rate are not a problem.