Hello,
I want to orient each piece of my packed geometry (output from the “assemble” node) correspondingly to my point attribute rotation/orientation.
Actually, I can drive position with the “point” node (cf. screenshot) but I don't know how to orient each piece by attribute which come from point/particle orientation (right branch of my graph).
As you can see in the screenshot, I can only do it manually.
How can I do this with a point attribute ?
I hope that's clear and sorry in advance if it's a newbie question.
Orient Pieces of Packed Geometry
19637 7 6- julca
- Member
- 219 posts
- Joined: 10月 2015
- Online
- mestela
- Member
- 1798 posts
- Joined: 5月 2006
- Online
set @orient (or @N and @up) on the points that you're feeding to the right-input of the copy sop.
I have a few examples of this here:
http://www.tokeru.com/cgwiki/index.php?title=Houdini [tokeru.com]
Specifically
http://www.tokeru.com/cgwiki/index.php?title=Houdini#Explicit_rotation.2Forient_control_for_copy_and_instances [tokeru.com]
and
http://www.tokeru.com/cgwiki/index.php?title=Houdini#Effector_for_scale.2C_rotation.2C_colour [tokeru.com]
I have a few examples of this here:
http://www.tokeru.com/cgwiki/index.php?title=Houdini [tokeru.com]
Specifically
http://www.tokeru.com/cgwiki/index.php?title=Houdini#Explicit_rotation.2Forient_control_for_copy_and_instances [tokeru.com]
and
http://www.tokeru.com/cgwiki/index.php?title=Houdini#Effector_for_scale.2C_rotation.2C_colour [tokeru.com]
- mestela
- Member
- 1798 posts
- Joined: 5月 2006
- Online
ah sorry, i saw you're not using a copy sop.
in that case you need to modify the intrinsic transform of your packed geo. I have another example of that, the ball of eyeballs a little earlier on that page, or right down the bottom where I talk about packed prims.
Ultimately its very similar to using orient, but you don't set orient.
Eg, a point wrangle would be something like
—–
float angle = @Time *@ptnum;
vector axis = {0,1,0};
matrix3 m = ident();
rotate(m, angle, axis);
setprimintrinsic(0, ‘transform’, @ptnum, m, ‘set’);
—–
(edit; added example)
in that case you need to modify the intrinsic transform of your packed geo. I have another example of that, the ball of eyeballs a little earlier on that page, or right down the bottom where I talk about packed prims.
Ultimately its very similar to using orient, but you don't set orient.
Eg, a point wrangle would be something like
—–
float angle = @Time *@ptnum;
vector axis = {0,1,0};
matrix3 m = ident();
rotate(m, angle, axis);
setprimintrinsic(0, ‘transform’, @ptnum, m, ‘set’);
—–
(edit; added example)
- julca
- Member
- 219 posts
- Joined: 10月 2015
- Online
- Toby Williams-Ellis2
- Member
- 8 posts
- Joined: 12月 2014
- Offline
I've just been looking at your examples, mestela, and the info on Houdini is the most amazing resource and such a help to making vex seem accessible - thank you for sharing what you know!
I have been trying to get instanced packed geo to rotate around the object normals using your vex example, with your examples of converting a matrix3 to a quaternion, but without much luck. After digging a bit on the subject, I found in the sidefx halloween tutorial that this is to do with the order of transformation, which he resolves in VOPs by using an align node with an up vector and the normals.
33:54 through the video:
https://vimeo.com/52551778 [vimeo.com]
I was just curious whether you knew if this was easy to achieve in vex wrangles - obviously it's not too much effort to use the vops option, but I love the idea of trying to do more in vex.
I have been trying to get instanced packed geo to rotate around the object normals using your vex example, with your examples of converting a matrix3 to a quaternion, but without much luck. After digging a bit on the subject, I found in the sidefx halloween tutorial that this is to do with the order of transformation, which he resolves in VOPs by using an align node with an up vector and the normals.
33:54 through the video:
https://vimeo.com/52551778 [vimeo.com]
I was just curious whether you knew if this was easy to achieve in vex wrangles - obviously it's not too much effort to use the vops option, but I love the idea of trying to do more in vex.
- mestela
- Member
- 1798 posts
- Joined: 5月 2006
- Online
I thought it was easy, ashamed to say it stumped me for a while. In the end I cheated and recreated the vop network in the video, then peeked at the generated vex code.
I suspect this could be done in 2 lines rather than 4, but this works:
A dihedral generates a matrix that will rotate one vector onto another. Ie, we generate a matrix that would lay a rotation axis along Y to sit along the normal.
Can then rotate that using rotate(), and convert to a quaternion.
I was sure you could do it in one line with @orient = quaternion(angle, @N). I'm sure someone smarter than me will show me what I'm missing.
-matt
I suspect this could be done in 2 lines rather than 4, but this works:
matrix3 m = dihedral({0,1,0},@N); float angle = rand(@ptnum)+@Time; rotate(m, angle, @N); @orient = quaternion(m);
A dihedral generates a matrix that will rotate one vector onto another. Ie, we generate a matrix that would lay a rotation axis along Y to sit along the normal.
Can then rotate that using rotate(), and convert to a quaternion.
I was sure you could do it in one line with @orient = quaternion(angle, @N). I'm sure someone smarter than me will show me what I'm missing.
-matt
- Toby Williams-Ellis2
- Member
- 8 posts
- Joined: 12月 2014
- Offline
Wow, thanks so much for taking the time to look at it - and so quickly! I would never have thought to look at the vex code generated from the vop, but shall carry that forward to next time.
Thanks again for your wiki page too - it's opened up a world of fun and feels like it's made things attainable that I thought would take years to get a handle on.
All the best,
Toby
Thanks again for your wiki page too - it's opened up a world of fun and feels like it's made things attainable that I thought would take years to get a handle on.
All the best,
Toby
- Toby Williams-Ellis2
- Member
- 8 posts
- Joined: 12月 2014
- Offline
Wow, thanks so much for taking the time to look at it - and so quickly! I would never have thought to look at the vex code generated from the vop, but shall carry that forward to next time.
Thanks again for your wiki page too - it's opened up a world of fun and feels like it's made things attainable that I thought would take years to get a handle on.
All the best,
Toby
Thanks again for your wiki page too - it's opened up a world of fun and feels like it's made things attainable that I thought would take years to get a handle on.
All the best,
Toby
-
- Quick Links