Login | Register 
Products Applications Downloads Features Wiki forum Store
 

particle geometry instancing question

Still a little green? Ask your beginner's questions here

particle geometry instancing question

Postby mji » Wed Jun 27, 2012 7:24 pm

Hi,
I'm attempting to use a particle system to do hardware instancing on a piece of geometry. That part works just fine... but I'd also like to be able to rotate the instanced geometry to face the direction in which each particle is moving. I know how to use instancing to do rotations... I just can't figure out a way of calculating this rotation on a per-particle basis. Any suggestions?
Thanks,
Michael
mji
 
Posts: 199
Joined: Tue Oct 28, 2008 3:21 pm

Re: particle geometry instancing question

Postby malcolm » Thu Jun 28, 2012 9:20 pm

I have a feeling you'll need to use a GLSL MAT for this. Use a SOP to CHOP to get the v[3] attribute, which is the velocity of the particle (direction and speed). Then pass that into the GLSL MAT as a texture buffer under the 'arrays' page. Using this vector in the vertex shader you need to determine the rotation for the instance (from (0,0,-1) to the v[3] vector), which is the tricky part. There is a function whose name I can get tomorrow which may help you, or you may find something good online about building a rotation matrix from two vectors which may solve the issue.
User avatar
malcolm
Staff
 
Posts: 2217
Joined: Tue Nov 13, 2007 12:11 am

Re: particle geometry instancing question

Postby mji » Fri Aug 24, 2012 2:32 pm

Ah, I see... this looks a bit trickier than I had originally thought... I think I'm going to try something else for now, but might have to revisit this later. Thanks!
mji
 
Posts: 199
Joined: Tue Oct 28, 2008 3:21 pm


Return to Beginners

Who is online

Users browsing this forum: No registered users and 1 guest