Jump to content

How to transform a primitive Circle SOP?


Recommended Posts

Hi,

I have a Circle SOP where the Type is set to Primitive. I use a VOPSOP to transform it, but rotations don't seem to have any effect on it.

I use this inside an Inline VOP where P is connected as input and PP is set to be an output:

matrix mat = maketransform(0, 0, {0,0,0}, {0,0,-45}, {1,1,1});
$PP = $P * mat;

If I set the Type to Polygon or anything other than Primitive it works. I imagine this is because with Primitive, there is only 1 point so it cannot be rotated but modifying the point normal also doesn't work. How are other SOPs like Transform are able to achieve this?

Thanks :)

Link to comment
Share on other sites

VOP SOP only works on Points and not other types like Primitives or Poygons. So when the VOP SOP cooks it only processes the single point created by the Circle SOP.

Primitive circles can be translated using the Primitive SOP (Transform SOP also works), but Primitive SOP will give you access to primitive local variables.

You'll have to add your rotation values as an attribute to the point, and then use those values in the Primitive SOP.

You'd have the same problem trying to do things to polygons in a VOP SOP.

Link to comment
Share on other sites

Thanks hopbin. Although polygons work because I am multiplying each point with a transform matrix so the whole polygon gets transformed.

I didn't know I could use the Primitive SOP, but for me using either that or the Transform SOP will be a little difficult, because I wanted to use the Align VOP which returns a rotation matrix, so will have to convert that into Euler style rotation unless I am missing something.

Link to comment
Share on other sites

I understand, but VOP is Point based and you want to manipulate Primitives.

I've wanted to submit a RFE to SESI to add support for Polygons to VOP. I find iterating points very limiting for most problems.

Alternatively you could do something in Python. I've found that far more flexible, but performance is always a concern.

  • Like 1
Link to comment
Share on other sites

Ok then, because I thought you meant this VOP method wouldn't work for Polygons, etc :)

Currently I use the "point * rotation_matrix" method for any type of a Circle SOP, but as soon as it's set to Primitive, that's when it doesn't work. The Python route would work but like you said it will be slower. But since Prims are created on a single point, might not be too bad.

But if people have different ideas, I am listening :)

Link to comment
Share on other sites

You need a vector of sorts on your point and then transform it, with the vector. I think, for example, that the transform sop does that by default (there is a little tick box at the bottom).

If you really really have to do it in vopsop I'd go and try adding a vector (off the top of my head I don't remember if vopsops transform normals by default or not), and if that doesn't work pretend there is a vector by offsetting the point by unit length, transforming, and then putting back again, keeping the calculated value as a normal. Not sure if that works, its an idea.

Btw, rather than 3-vectors, quaternions are very good for this sort of thing. Especially if you are dealing with rotations a whole world of nastiness will appear with Euler rotations.

Now, I don't know what you are doing, but you could also use a point, with a normal or quaternion, and then copy stamp a primitive circle to it. That would also allow you to rotate the thing.

Edited by Macha
  • Like 1
Link to comment
Share on other sites

Thanks Macha. I tried transforming the point normal as if you use transform the primitive circle using the Transform SOP, it actually changes the point normal that the primitive circle has. But me transforming the point normal doesn't change the orientation of the primitive circle.

Basically I am sort of what Copy SOP is doing like you said except on a smaller scale, just to transform the circle.

By your idea, do you mean something like?:

P + {1,0,0} -> transform -> Result - {1,0,0}?

I just tried that but the circle moved as a whole without changing its direction.

So what does influence the orientation of a circle if it's not its normal?

Link to comment
Share on other sites

I guess internally it does represent the 'primitive' as points, but for some reason they are not exposed. If you reduce the level of detail in the preferences you can see them clearly. The only clear way I can think of is the copy-sop idea I mentioned above.

Edited by Macha
Link to comment
Share on other sites

Thanks Macha. That was also my understanding of primitive objects that they are just mathematical representations of objects created at a point. Like a sphere primitive has no additional geometry other than a representation of a sphere like a gizmo.

So since the only thing that's really there is a point, other operators such as the Transform SOP must be using some special rules to transform them I think.

Sounds like a good challenge :)

Edited by magneto
Link to comment
Share on other sites

These primitive types (circle, sphere, tube) are known in Houdini as Quadric primitives. The one point/vertex you see is only used to determine the center of the shape. The actual orientation of the object is defined by a 3x3 matrix, which cannot be manipulated through VOPs as it belongs to the actual primitive object. You'll have to use either the Primitive or Transform SOPs, or Python to transform them.

See the Geometry HDK docs for more information:

http://www.sidefx.com/docs/hdk12.1/hdk_geometry_intro.html#HDK_GeometryIntro_Primitives_Quadric

  • Like 1
Link to comment
Share on other sites

  • 2 weeks later...

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