Jump to content

Up vector and rotations for particles


Dee

Recommended Posts

Hi! I need help again. I need to get the rotation out of particles when all I have is the normal to follow along with standard variables.

I'll tell you what I did and perhaps someone can tell me how to proceed.

I needed to make particles flutter down like papers or leaves wafting back and forth on a breeze. I can't just use rotation because they needed to have an imaginary "hinge" that they rotate from to give them a "swinging back and forth" look while they move through a breeze. So, I made a Vop Pop that makes the particles flutter with that by taking a point position a few units up from the particle, making a vector between the two, and swinging the particle from that using sine functions. I assign the vector I created for this as the particle normal afterwards. This gives me the motion and rotation that I need. The problem is, my particle system is too dense, so the only solution is to use instancing at render time. I'm not using mantra. The prman-like renderer I use can take a rotation variable and apply it to the instances. My problem is getting that rotation. I have my created normal, but I have no idea how to create the rotation variable.

I'm told I should take an X vector, cross multiply that with N to get an orthagonal 'Up' vector and use that to get the rotation, but I'm at a loss as to how to do that. It is taking me a while to wrap my head around it. Can anyone explain how to do this?

Thank you!

~Dee

Link to comment
Share on other sites

I gave it a shot, but I'm not sure it's fully working :).

I based it on spherical coorditates: http://en.wikipedia.org/wiki/Spherical_coordinates

If I understood your problem correct, you have a vector (N) and you want to orient your leaves based on that vector. Similar to aiming them along that vector.

Since you already have the positions of the particles in place, I did not implement translation, only orientation.

Let me know if this is at all in the direction you are looking for.

falling_leaves.hip

Link to comment
Share on other sites

I gave it a shot, but I'm not sure it's fully working :).

I based it on spherical coorditates: http://en.wikipedia.org/wiki/Spherical_coordinates

If I understood your problem correct, you have a vector (N) and you want to orient your leaves based on that vector. Similar to aiming them along that vector.

Since you already have the positions of the particles in place, I did not implement translation, only orientation.

Let me know if this is at all in the direction you are looking for.

Yes! Thank you! That's exactly what I was looking for! I had been running into the problem of random orientation flips. I had no idea there was another atan built-in that fixed the problem. This is great! Thank you! This fixes the problem I came here for and more. Thank you so much!

~Dee

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...