View Full Version : particle system

debonair

07-07-2014, 08:04 PM

I am implementing particle system in which I want particles to rotate around each other i.e. its own axis along with translational motion outwards from the emitter.

I have outward motion of particles working but I am not able to figure out how to add rotational motion along with it.

here are the equations I am using for motion:

My geometry shader:

vec3 dir= GetRandomDirectionFromTexture();

vec3 vel= normalize(dir);

out.position=input.position + (vel * DeltaTimeInSec);

out.velocity= input.velocity+ (Acceleration * DeltaTimeSec);

debonair

07-08-2014, 09:32 PM

bounce.!!!

carsten neumann

07-09-2014, 07:46 AM

You need to define a local coordinate system for each particle, so that it makes sense to talk about local rotations. Presumably your particles are essentially just points, so that in and of itself is not enough to define a unique local coordinate system. You could perhaps use cross products of a particle's position vector with a coordinate axis and/or the view vector to (artificially) define such a local coordinate system.

debonair

07-09-2014, 09:11 AM

Can you please specify the equations?

I am using billboard technique to render particles. Here is my part of the geometry shader:

vec3 pos=gl_in[0].gl_Position.xyz;

vec3 cameraV=normalize(EyePosition.xyz - pos );

vec3 up= vec3(0.0, 1.0, 0.0);

vec3 right= normalize(cross(up,cameraV))*0.01;

up=cross(cameraV,right);

gl_Position=vec4(pos - (right + up),1.0);

gl_Position=vec4(pos + ( right- up),1.0);

gl_Position=vec4(pos- (right - up),1.0);

gl_Position=vec4(pos + ( right+ up),1.0);

carsten neumann

07-09-2014, 09:59 AM

This looks like you have a local coordinate system (right, up, cameraV) - if you want to rotate the billboard, apply a rotation matrix to these base vectors - sorry don't have any canned code for that.

Powered by vBulletin® Version 4.2.3 Copyright © 2018 vBulletin Solutions, Inc. All rights reserved.