Results 1 to 5 of 5

Thread: particle system

  1. #1
    Senior Member Regular Contributor
    Join Date
    Apr 2012
    Posts
    318

    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
    Senior Member Regular Contributor
    Join Date
    Apr 2012
    Posts
    318
    bounce.!!!

  3. #3
    Newbie Frequent Contributor
    Join Date
    Mar 2016
    Posts
    896
    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
    Senior Member Regular Contributor
    Join Date
    Apr 2012
    Posts
    318
    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
    Newbie Frequent Contributor
    Join Date
    Mar 2016
    Posts
    896
    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.

Similar Threads

  1. Particle System
    By Unresolved External in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 03-30-2011, 08:56 AM
  2. Particle System
    By micetta2482 in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 05-14-2010, 11:05 AM
  3. Particle System API
    By cochondinde in forum OpenGL: Advanced Coding
    Replies: 1
    Last Post: 02-20-2005, 03:37 AM
  4. Particle System
    By Coluna in forum OpenGL: Basic Coding
    Replies: 0
    Last Post: 03-13-2003, 09:09 PM
  5. Particle system?
    By CyBBe in forum OpenGL: Basic Coding
    Replies: 8
    Last Post: 05-16-2000, 11:10 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean