space particles - preformance issues

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
r5ive
Posts: 20
Joined: Wed Jun 18, 2008 5:42 pm
Location: Berlin

space particles - preformance issues

Post 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
vitek
Bug Slayer
Posts: 3919
Joined: Mon Jan 16, 2006 10:52 am
Location: Corvallis, OR

Post 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
r5ive
Posts: 20
Joined: Wed Jun 18, 2008 5:42 pm
Location: Berlin

Post by r5ive »

does anyone have any suggestions how to realize that?
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Post by Virion »

r5ive wrote:does anyone have any suggestions how to realize that?
checkout the tutorials you should see sample usage of billboard
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post 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.
r5ive
Posts: 20
Joined: Wed Jun 18, 2008 5:42 pm
Location: Berlin

Post by r5ive »

thank you
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post 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.
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
r5ive
Posts: 20
Joined: Wed Jun 18, 2008 5:42 pm
Location: Berlin

Post 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
BlindSide
Admin
Posts: 2821
Joined: Thu Dec 08, 2005 9:09 am
Location: NZ!

Post 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".
ShadowMapping for Irrlicht!: Get it here
Need help? Come on the IRC!: #irrlicht on irc://irc.freenode.net
hybrid
Admin
Posts: 14143
Joined: Wed Apr 19, 2006 9:20 pm
Location: Oldenburg(Oldb), Germany
Contact:

Post 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.
r5ive
Posts: 20
Joined: Wed Jun 18, 2008 5:42 pm
Location: Berlin

Post by r5ive »

thank you so far, i will try :)
Post Reply