Jump to content

How to align copies based on a vector using the Copy SOP?


Recommended Posts

I know the Copy SOP uses point normals if they exist on the template. It seems like it's aligning +Z with the point normal, but how can I control this so I can align any other axis to this point normal?

What if I want the model's +X to be aligned to the point normal? Or an arbitrary vector3?

I know there is also the up vector but that only seems to control the roll along the point normal.

Right now I use a Transform SOP, but feel like there is a better way to control this precisely.

Any ideas?

Thanks :)

Edited by magneto
Link to comment
Share on other sites

Short answer:

Use a vector called "up" as your y axis.

Long answer:

There's a help page on this if you search for "copying and instancing point attributes", but here's the main breakdown...

  • orient float4 (quaternion) Orientation of the copy
  • pscale float Uniform scale
  • scale float3 Non-uniform scale
  • N vector Normal (+Z axis of the copy, if no orient)
  • up vector Up vector of the copy (+Y axis of the copy, if no orient)
  • v vector Velocity of the copy (motion blur, and used as +Z axis of the copy if no orient or N)
  • rot float4 (quaternion) Additional rotation (applied after the orientation attributes above)

#

If the orient attribute exists

Use it to orient the copy/instance.

If the orient attribute does not exist

Orient the copy/instance using N as the +Z axis and up as +Y axis.

If N does not exist, use v (velocity) if it exists.

If the rot attribute exists, apply it after the above.

Edited by tjeeds
  • Like 2
Link to comment
Share on other sites

Thanks tjeeds, I saw that page, very useful. I tried the up vector but when I change it the model is still fixed on the +Z. All it changed was the roll around the point normal.

So should I be using orient? I haven't tried it. Basically mine is sort of a remapping of a single axis instead of always using +Z.

Link to comment
Share on other sites

Thanks Edward, that's what I am doing :)

I thought I was missing a crucial thing that could make this work via "orient" or "up", etc.

Although this pre-rotating has a flaw. If the geometry that will be copied is offset, then you have to figure out the center of the rotation (pivot), whether centroid, or {0,0,0}, or another point.

Link to comment
Share on other sites

Wouldn't you run into this problem even if you had a custom axis for aiming in the same direction as the normal? Wouldn't the rotation still be using (0,0,0) as the pivot in the Copy SOP?

Note that if you want to centre the geometry using the Transform SOP, use -$CEX, -$CEY, -$CEZ for the Translate parameter value.

  • Like 1
Link to comment
Share on other sites

Thanks Edward, you are right :)

What about using dihedral expression? Would this help you think? I tried it briefly but then it seemed to disrupt the other axis.

In your -$CEX example, would using $CEX, etc for the pivot do the same thing? I guess yours actually translates the geometry where pivot only changes the pivot.

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...