How to reset rotation to default value with Transform SOP?

   3030   2   3
User Avatar
Member
67 posts
Joined: 5月 2019
オフライン
I probably missing something obvious but I'm looking for something like "restore rotation to defaults" at the SOP level. Visual example but from Blender (15-sec clip): Reset Object Transformations in Blender [www.youtube.com].

Context: I have 3 objects, I'm looping over them, adding a Match Size SOP to center them out for further manipulation. 2 of them facing the X axis, 1 in the Z axis.

Goal: All objects face the same axis no matter what axis were upstream.





What I've tried:

I've read the forum and found only about “Clean transform” on the object level: https://www.sidefx.com/forum/topic/13089/?page=1#post-62123 [www.sidefx.com] and similar things.

I've also tried Primitive Properties SOP node [www.sidefx.com] with "Do Transformation" turned on (1st input object to rotate, 2nd input created point with an Add SOP which transformed to positive X). It worked for me with geo without any loops (like a grid with 2 rows and 2 columns), which is not in my case.

Is it possible with Transform SOP? Is there a node that does that? Or it's a VEX implementation?

Thank you 🙂
Edited by AnimGraphLab - 2023年7月2日 07:43:59

Attachments:
current_vs_expected.png (6.4 MB)
forum_reset_rotation.hiplc (137.5 KB)

Generalist. Transforming still images to 3D animation 🔮
Socials: https://linktr.ee/AnimGraphLab [linktr.ee]
User Avatar
Member
405 posts
Joined: 4月 2017
オフライン
So in SOPs, geometry doesn't have any sense of a transform unless it's packed. You could save the transformation of each extruded chunk as a detail attribute via the "Output Attribute" parameter on the Transform SOP, promote it to points, and then apply the inverse transform later on with Transform by Attribute SOP or a bit of code.

Packing makes this a bit easier and more performant. Before you transform your objects, pack them. Then you can do whatever transformations you want, and if you ever need them to go back to their default state, you just need to do a little VEX to reset the transform intrinsic attribute of the packed primitives:

matrix3 xform = ident()
setprimintrinsic(0, "transform", @ptnum, xform);
@P = 0;

If you wanted to do this without code, you could try MOPs Apply Attributes [github.com]. It makes packed transforms easier to handle with little to no VEX required.

I attached your file back with both the above methods shown.

Attachments:
forum_reset_rotation_toadstorm.hiplc (167.7 KB)

MOPs (Motion Operators for Houdini): http://www.motionoperators.com [www.motionoperators.com]
User Avatar
Member
67 posts
Joined: 5月 2019
オフライン
Toadstorm (Henry? 🙂), grateful for your response!

You could save the transformation of each extruded chunk as a detail attribute via the "Output Attribute" parameter on the Transform SOP, promote it to points, and then apply the inverse transform later

Oh my God, I was tinkering with xform so much but never thought about promoting it back to points. Now it makes a lot more sense why it worked! Can't appreciate it enough 🙂


In SOPs, geometry doesn't have any sense of a transform unless it's packed

Interesting 👍👍


P.S. - looking forward to purchasing MOPs+ in the right situation. Thank you for making it!
Edited by AnimGraphLab - 2023年7月2日 14:22:07
Generalist. Transforming still images to 3D animation 🔮
Socials: https://linktr.ee/AnimGraphLab [linktr.ee]
  • Quick Links