Jump to content
  • Advertisement
Sign in to follow this  
Ey-Lord

Particles Engine

This topic is 4916 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello hello , im trying to build my own particles engine ( as some of you suggested ), and i got some questions 1) any *performances" tips is welcome . ANY :) 2) I cant find how the others are getting blending to do what they whant ! ( what i want is -> in the center of my FX ( where there is more aprticles ), it appear ~ white ; i noticed ppl use ( gl_scr_alpha , gl_one ) . but a ) i tried, it doesnt do what its suposed to do b ) it seems to sux if i draw my FX OVER a textured quad . 3) I reaally need some performance adives ;) Thx !!

Share this post


Link to post
Share on other sites
Advertisement
I personally use additive blending when I try to simulate flames or bright particles, for that glBlendFunc(GL_ONE, GL_ONE) does the trick for me.
I can't think of too many performance tips, if you're using immidiate calls it's time to switch to VA or dynamic VBO's. You can always give the ARB_point_sprite a run and see whether that boosts performance or not (even though it seems broken on certain hardware like when you introduce custom texture coordinates to Radeon 9700s).
Now can you post a screenshot visually describing the "hideous" :D result mentioned in b?
I have other suggestions about building a nice particle engine since I've done the same just few weeks ago, let me know if you need any further help.
Peace dude.

Share this post


Link to post
Share on other sites
re , (GL_ONE , GL_ONE ) doesnt do the trick for me :)
i seend 2 source of particule engine ( nehe's and a french one ) , both very simple, they use ( GL_SRC_ALPHA , GL_ONE ), i tried taht too ... didnt worked :/
I may me missing something :/

im not familliar with this vocabulary , immediate calls = glbegin(), glend() ?
if yes, yup that's what im using .
I dont know what VA and VOB stand for, but im sure i can find ;) ill check that .

Concerning the FX over my texture, it isnt "hideous" , it's just blending with my texture witch isnt cool ^^ anyway, the pb is the same w/o texture, i cant find the "missing" parameter that blend correctly .

( i.e i want that when their is many particles on the same spot, it does become lighter . )

AS im just starting this , ill certainly need further help :) thx a lot .

Share this post


Link to post
Share on other sites
First: you need to enable blending (see above post)

As for Performance: When particles die don't deallocate the memory just flag them as 'dead' and recycle those dead particles to respawn new ones when needed.
NOTE: a simpler particle system might get away with just re-initialising particles that die to avoid the overhead of finding and flagging dead particles.

VA = Vertex array
VBO = vertex buffer object
Both of these can be used to increase performance over immeadiate mode (glBegin and glEnd)

ARB_point_sprite is (likely to be) faster but much less flexible

Why not build your system with the flexibility to choose the blending criteria rather than hard-coding it.

Share this post


Link to post
Share on other sites
offcourse i have enabeled blending ;) but i cant find a way to get the result i want .

When particles die, i just change their life value from 0 to 1 :) so no reallocations .

ill check VA ; VBO seems a little complicated .
im still lost ;o)
ty anyways

Share this post


Link to post
Share on other sites
i have an architecturally sound particle system that relies on heavy use of virtual functions if you're interested. unfortunately its not built with performance in mind.

if you want performance don't allocate and re-allocate particles, simple flag them as dead or not.
also use fixed sized arrays (boost::multi_array).

good luck :)

Share this post


Link to post
Share on other sites
hehe i already said that i flag them :)
and yeah i was using a vector ...forgot that iterator is the slow !
Im using a "normal" tab, with fixe size .
I got 275 fps, ( 200 with vector)-> only 6000 particles .. i have many optimisations to do :p but thats not my first goal :) my first goal is too get those fucking particle to get lighter when their are a lot on the same space .^^

thx anyway :)

edit : can i know more about your particle system ?

Share this post


Link to post
Share on other sites
see my website below ive been working on a particlesystem designer recently (theres an oldishish screenshot there), u can change the textures/blending etc during runtime which helps u achieve the look u want
* point_sprite is useless (i recently removed it from my game) the only reason u would want to use it is if youre drawing >10,000 tiny particles
*the thing that tends to kill preformance in particles is the overdraw (not the number of particles) this comes cause usually u have depthwrites off, blending on thus the same pixel onscreen can be overdrawn many many rimes, ways of improving this are texturecompression alphatest etc

Share this post


Link to post
Share on other sites
One possible cause is: To make the particle system go to white as more particles overlap each other, you need the particles to have at least a small amount of each of the R, G, and B components. If your particle was say, red (255, 0, 0) then red plus a bunch more red is still red. But if you have something like (255, 1, 1) then a bunch of those will eventually add to (255, 255, 255).

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!