Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: particle system

  1. #1
    Junior Member Regular Contributor
    Join Date
    Jun 2012
    Posts
    207

    particle system

    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:

    Code :
     
    vec3 dir= GetRandomDirectionFromTexture();
    vec3 vel= normalize(dir);
    out.position=input.position + (vel * DeltaTimeInSec);
    out.velocity= input.velocity+ (Acceleration * DeltaTimeSec);

  2. #2
    Junior Member Regular Contributor
    Join Date
    Jun 2012
    Posts
    207
    bounce.!!!

  3. #3
    Advanced Member Frequent Contributor
    Join Date
    Apr 2010
    Posts
    741
    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.

  4. #4
    Junior Member Regular Contributor
    Join Date
    Jun 2012
    Posts
    207
    Can you please specify the equations?
    I am using billboard technique to render particles. Here is my part of the geometry shader:

    Code :
    	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);

  5. #5
    Advanced Member Frequent Contributor
    Join Date
    Apr 2010
    Posts
    741
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •