Particle System bugs

Whether you're a newbie or an experienced programmer, any questions, help, or just talk of any language will be welcomed here.

Moderator: Coders of Rage

K-Bal
ES Beta Backer
ES Beta Backer
Posts: 701
Joined: Sun Mar 15, 2009 3:21 pm
Location: Germany, Aachen
Contact:

Re: Particle System bugs

Post by K-Bal »

The most effective way to do so is using a shader to update the particle positions. This way you don't have to transfer data through the bus, but it's also relatively complex. I could help you, though.

If you don't want to do this, try to use glDrawArrays on your raw data instead using a VBO and tell us if it is faster:

Code: Select all

glVertexPointer(3, GL_FLOAT, 0, &pos);
User avatar
mv2112
Chaos Rift Junior
Chaos Rift Junior
Posts: 240
Joined: Sat Feb 20, 2010 4:15 am
Current Project: Java Tower Defence Game
Favorite Gaming Platforms: N64/Xbox 360/PC/GameCube
Programming Language of Choice: C/++, Java
Location: /usr/home/mv2112
Contact:

Re: Particle System bugs

Post by mv2112 »

K-Bal wrote:The most effective way to do so is using a shader to update the particle positions. This way you don't have to transfer data through the bus, but it's also relatively complex. I could help you, though.

If you don't want to do this, try to use glDrawArrays on your raw data instead using a VBO and tell us if it is faster:

Code: Select all

glVertexPointer(3, GL_FLOAT, 0, &pos);
I ended up re-writing my particle system, but this time with openGL in mind. It now runs REALLY FAST with 100,000 particles! My old particle system code was trash, the new code is shiny and clean! It does run faster with the VBO, rather than with just raw data.
User avatar
mv2112
Chaos Rift Junior
Chaos Rift Junior
Posts: 240
Joined: Sat Feb 20, 2010 4:15 am
Current Project: Java Tower Defence Game
Favorite Gaming Platforms: N64/Xbox 360/PC/GameCube
Programming Language of Choice: C/++, Java
Location: /usr/home/mv2112
Contact:

Re: Particle System bugs

Post by mv2112 »

http://www.youtube.com/watch?v=ZxrKP1GQdxU
Here is a little demo i made
User avatar
GroundUpEngine
Chaos Rift Devotee
Chaos Rift Devotee
Posts: 835
Joined: Sun Nov 08, 2009 2:01 pm
Current Project: mixture
Favorite Gaming Platforms: PC
Programming Language of Choice: C++
Location: UK

Re: Particle System bugs

Post by GroundUpEngine »

mv2112 wrote:http://www.youtube.com/watch?v=ZxrKP1GQdxU
Here is a little demo i made
Nice work! VBO's pwn :)
User avatar
mv2112
Chaos Rift Junior
Chaos Rift Junior
Posts: 240
Joined: Sat Feb 20, 2010 4:15 am
Current Project: Java Tower Defence Game
Favorite Gaming Platforms: N64/Xbox 360/PC/GameCube
Programming Language of Choice: C/++, Java
Location: /usr/home/mv2112
Contact:

Re: Particle System bugs

Post by mv2112 »

GroundUpEngine wrote:
mv2112 wrote:http://www.youtube.com/watch?v=ZxrKP1GQdxU
Here is a little demo i made
Nice work! VBO's pwn :)
Thanks! 0_o

Does anyone know any good ways of controlling the particles? Like how to get the particles to emit from a point in a circle, algorithms, and stuff like that?
User avatar
Bakkon
Chaos Rift Junior
Chaos Rift Junior
Posts: 384
Joined: Wed May 20, 2009 2:38 pm
Programming Language of Choice: C++
Location: Indiana

Re: Particle System bugs

Post by Bakkon »

Your particles seem to be making a square shape instead of circular. Try normalizing the direction vector.
User avatar
mv2112
Chaos Rift Junior
Chaos Rift Junior
Posts: 240
Joined: Sat Feb 20, 2010 4:15 am
Current Project: Java Tower Defence Game
Favorite Gaming Platforms: N64/Xbox 360/PC/GameCube
Programming Language of Choice: C/++, Java
Location: /usr/home/mv2112
Contact:

Re: Particle System bugs

Post by mv2112 »

Bakkon wrote:Your particles seem to be making a square shape instead of circular. Try normalizing the direction vector.
Thats the thing, im just generating random offsets to make the particles move the way they are, im looking for an efficient way of making them go in a circle, i have no circle algorithm type thing...
User avatar
avansc
Respected Programmer
Respected Programmer
Posts: 1708
Joined: Sun Nov 02, 2008 6:29 pm

Re: Particle System bugs

Post by avansc »

not tested, but im sure this will do something like that.

Code: Select all

vel =  rand()%MAX_VEL;
float ang = rand()%360;
ang /= 180*PI;
x_vel = vel*cos(ang);
y_vel = vel*sin(ang);
not efficient, but just a start.
Some person, "I have a black belt in karate"
Dad, "Yea well I have a fan belt in street fighting"
Post Reply