Pixel explosions look cubic

Started by
4 comments, last by GuyJohnston 22 years, 6 months ago
I made a 3D pixel explosion algo that worked alright. The problem was that they looked awfully cubic. It would be nice if they looked more spherical. They were cubic because of the way I generated their random vectors into space. It was very basic setting x, y, z limits of say -0.3f to +0.3f. How could I generate those random vectors so the resulting explosion would look spherical ? Guy
Adulthood is the vehicle for making you childhood dreams come true.
Advertisement
generate three random numbers.

one between 0.0 and 3.0(radius)
one between -PI and +PI(theta)
one between -PI/2 and +PI/2(phi)

x = radius * cos ( theta ) * cos ( phi )
y = radius * sin ( theta ) * cos ( phi )
z = radius * sin ( phi )




Get off my lawn!

Using what TANSTAAFL said, define a quaternion for an elliptical shell and use this as your BB for the explosion. Use the mean distance between surfaces (your outer to shell''s inner) to determine the avg rate of expansion for each axis. Should be a good start

-----------
-WarMage
...and if that don''t work, then try...something else!!

Thanks Guys, that''s very cool stuff.

TANSTAAFL, just pinned that algo up on the old
bulletin board.

Guy
Adulthood is the vehicle for making you childhood dreams come true.
I now have round pixel explosions. Great stuff.


Thanks again,

Guy

Edited by - GuyJohnston on October 19, 2001 11:23:24 AM
Adulthood is the vehicle for making you childhood dreams come true.
For more evenly distributed particles (ie not more dense around one axis), use the first algorithm, then make sure your point is within your radius. If not, get another random point.

This topic is closed to new replies.

Advertisement