How could I rotate "Copied to Points" geos randomly...?

   54899   12   5
User Avatar
Member
415 posts
Joined: Aug. 2015
Offline
Hello;

I copied several geometries on a grid, using “Copy to Points” SOP and “For each loop”…
All copies have same Transforms, so how can I rotate each piece randomly?

(I attached my scene here)


Thanks.
Edited by Masoud - May 8, 2017 07:08:43

Attachments:
Copy_Varying geometry across the copies .hip (61.7 KB)
Capture.JPG (131.2 KB)

Masoud Saadatmand (MSDVFX)
User Avatar
Member
1268 posts
Joined: March 2014
Offline
Use an Attribute randomize on the points before the copy SOP. Set the attribute inside to pscale or orient
Werner Ziemerink
Head of 3D
www.luma.co.za
User Avatar
Member
415 posts
Joined: Aug. 2015
Offline
Hi Werner Ziemerink;
I did but nothing changed …!
Masoud Saadatmand (MSDVFX)
User Avatar
Member
146 posts
Joined: June 2016
Offline
put a pointwrangle node above your foreach loop and
type this to get what you want

@orient = rand(@ptnum);

copy to points will rotate the copied geos based on certain attributes present in the template points such as N v and orient. I would suggest the best to use is orient, But N is simple it will align the z axis of your source geo to the normal of the template points

Read the below page to know how houdini aligns the instanced objects
http://www.sidefx.com/docs/houdini16.0/copy/instanceattrs [sidefx.com]


you can add attribute randomize to the template points before copy sop like werner says and you should change the dimension to 4 in the attribute randomize sop as orient is a 4float attribute.

Attachments:
1.png (895.4 KB)
2.png (1020.0 KB)

Mohan Pugaz
movfx
https://www.instagram.com/movfx/ [www.instagram.com]
https://www.youtube.com/channel/@_movfx
User Avatar
Member
116 posts
Joined: April 2016
Offline
This must be one of the most asked questions I see about Houdini, probably because it's one of the more common workflows. It really is time that we get a node for taking care of the various transforms and their randomization's we tend to do when copying.

edit: actually a masterclass on setting something like this up would be a good intro into the workflow of houdini.
Edited by Simon van de Lagemaat2 - May 8, 2017 22:14:51
Simon van de Lagemaat
owner the Embassy VFX
User Avatar
Member
415 posts
Joined: Aug. 2015
Offline
Thanks everyone.

Thank you Mohanpugaz,
“PointWrangle ” and “Attribute Randomize” works fine.
I'm wonder why “Attribute Create” with same configurations doesn't works!
Masoud Saadatmand (MSDVFX)
User Avatar
Member
471 posts
Joined: Nov. 2013
Offline
Masoud
Thanks everyone.

Thank you Mohanpugaz,
“PointWrangle ” and “Attribute Randomize” works fine.
I'm wonder why “Attribute Create” with same configurations doesn't works!

Hello dude.
Yes, it shouldn't work because the type of the orient attribute is vector 4 (Quaternion) not just ordinary vector which has 3 components.
Therefore in attribute create node set the type to float and set the size to 4.
Now you should see something…
User Avatar
Member
35 posts
Joined: Feb. 2018
Offline
you can randomize @N within randomize attribute SOP inside a sphere
Edited by paranoidx - Feb. 23, 2021 00:05:36
User Avatar
Member
14 posts
Joined: March 2019
Offline
I did the following for random rotation in the attribrandomize Node

....

Attribute Name: orient
Operation: Set Value
Distribution: Direction or Orientation
Dimensions: 4

Hope that helps a newbie like me somewhere...
User Avatar
Member
16 posts
Joined: July 2020
Offline
Fwiw there is the `scatter and align` node now built in for doing random rotation along normals
User Avatar
Member
8 posts
Joined: Aug. 2023
Offline
I just installed Houdini, watched first tutorial lesson, and wanted to add extra rotation to donuts falling down. Came here to find an answer. I've added new attribute randomizer node and didn't know what attribute name to put. Don't know how you folks know those. I am sure there is a way to find out all the available attribute. I expected a dropdown or smth, but it wasn't there. Anyway, this thread helped - it's `orient`, but also it needs 4 values. But! It seems like this property is a quaternion, which means if i want to restrict rotation to some axis I would need to get a PHD to understand how quaternions work.
But! I was playing a bit and found that You can change `distribution` parameter to "Direction or orientation" And there is a `Cone Angle` Slider that kinda does what I wanted (though I still don't know what it does exactly.
Anyway, I thought next person like me might enjoy this discover to make falling dunuts a bit more fun.
User Avatar
Member
385 posts
Joined: April 2017
Offline
If you want to apply rotation around specific axes to existing points (meaning Scatter and Align isn't exactly what you need), you can use MOPs Randomize SOP to do local or world random rotations.

The manual way to do it is with a bit of VEX. First you create a transform matrix or quaternion based on your existing N and up values, then you rotate that matrix or quaternion, then output to p@orient or 3@transform (or @N and @up) depending on your preference.

vector fwd = v@N;
vector up = {0,1,0};
// if you don't have a defined up vector but want to compute one the way houdini does it natively,
// compute the rotation that rotates +Z to N and apply this to +Y...
// matrix3 d = dihedral({0,0,1}, fwd);
// up = normalize(d * up);

matrix3 m = maketransform(fwd, up);
// now you can rotate this around whatever axis you want.
vector axis = normalize(chv("axis")); // or use an existing vector attribute!
float angle = radians(ch("angle")); // or use a random float attribute!
rotate(m, angle, axis);

// now convert this rotated matrix to a quaternion and bind to p@orient. copy to points and/or DOPs will understand this.
p@orient = quaternion(m);
MOPs (Motion Operators for Houdini): http://www.motionoperators.com [www.motionoperators.com]
User Avatar
Member
7 posts
Joined: July 2014
Offline
that instanced geo link on SideFX is now here: Copying and instancing point attributes [www.sidefx.com]
  • Quick Links