Page 1 of 1

space particles - preformance issues

Posted: Fri Aug 28, 2009 1:21 pm
by r5ive
hello,

i was going to simulate a ship flying through space and in order to see a movement i created sphere around the ship with lots of particles. the general idea is to use a fixed amount of particles. does a particle leave a given radius, it will be placed in front of the ship again (it actually depends on the moving direction).

i use an arraylist of IBillboardSceneNode's that are children of a ISceneNode. every frame i check distances between ship and particles (and so on...) and update the arraylist. the postition of the particle sphere i actually set using the ISceneNode (parent node).

is this an efficient way to render those particles? i think the idea is good, but my implementation looks somehow unprofessional. does anyone have any suggestions?

if not: is a parent scenenode necessary actually, since the particles arent really moving? is an array sufficent?

thanks

Posted: Fri Aug 28, 2009 7:32 pm
by vitek
No, that is not an efficient representation of the particles. Each billboard is just two triangles and one draw call. If you used an actual particle system, it would be one draw call for all of the billboards, which is much more efficient.

Travis

Posted: Mon Sep 07, 2009 7:44 am
by r5ive
does anyone have any suggestions how to realize that?

Posted: Mon Sep 07, 2009 8:41 am
by Virion
r5ive wrote:does anyone have any suggestions how to realize that?
checkout the tutorials you should see sample usage of billboard

Posted: Mon Sep 07, 2009 9:23 am
by hybrid
Well, actually the usage of particles is being looked for, which is shown in example 8 and in the demo. Should be enough to get a start.

Posted: Mon Sep 07, 2009 12:39 pm
by r5ive
thank you

Posted: Tue Sep 08, 2009 6:00 am
by BlindSide
In Star Sonata I used a buffer of vertices rendered as a point cloud. I think it's a much better way than using a particle system.

Posted: Tue Sep 08, 2009 7:15 am
by r5ive
hi,

it is possible to remove and add vertices into a buffer to simulate a moving ship? since i intend to realize a nearly endless space a static point cloud seems not to be sufficient.

do you have a code example?

thanks

Posted: Tue Sep 08, 2009 8:50 am
by BlindSide
Yeah I did something like that.

You can use SMeshBuffer and then access the "Vertices" and "Indices" array to remove/add vertices. For a point cloud your indices can just be "0,1,2,3,4,etc".

You can use the EHM_STATIC mapping, just make sure to do "setDirty" on the mesh buffer after you modify it so that it gets updated.

Then you can draw it via "IVideoDriver::drawMeshBuffer" and remember to use the "PointCloud" setting in SMaterial. Set the material first using "IVideoDriver::setMaterial".

Posted: Tue Sep 08, 2009 1:31 pm
by hybrid
Using drawVertexPrimitiveList and EPT_POINTS or EPT_POINTSPRITES should be even better, as you only need one index per point, otherwise you always get a multiple of 3 points.

Posted: Tue Sep 08, 2009 3:20 pm
by r5ive
thank you so far, i will try :)