Archived

This topic is now archived and is closed to further replies.

Ratman

Particles Systems

Recommended Posts

Ratman    181
How do do particle systems look in an ISO metric view? Ive written them before for basic top-down 2D games. Im wondering if the perspective would make a "normal" particle system look bad... anyone have any experience with that? --------------- Ratfest.org

Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster

You''d need to base your particle system off 3D particles, then render them ISOfied. Something like this:

  

struct Particle
{
int pos_x; // east/west axis

int pos_y; // north/south axis

int pos_z; // up/down axis

int color;
} particle[1000];

// rendering pseudocode

// assuming -z is up, and on screen ratio

// of y to x is like 3:4


void render_all_particles(void)
{
int screen_x;
int screen_y;

for(all particles)
{
screen_x = particle[i].pos_x;
screen_y = 3*(particle[i].pos_y+particle[i].pos_z)/4 ;
draw_particle(&particle[i], screen_x, screen_y)
}
}



You''d have to play around with the particle-position-to-screen-position transformation, but I think you get the general idea here.

I think it''d look pretty neat. In fact, I think I will code up something tonight ...



Share this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster

Probably want to do more like

  

// these would be precalculated


float x_fac = 1.000;
float y_fac = cos(view_angle);
float z_fac = sin(view_angle);

screen_x = x_fac*particle[i].pos_x;
screen_y = y_fac*particle[i].pos_y + z_fac*particle[i].pos_z;



Advantage: you can easily change the ?_fac values to anything you want.

I''d recommend doing a full floating point represenation (or fixed point for those who like that stuff) to prevent float to int conversions.

Share this post


Link to post
Share on other sites