best practice to scale primitive using VEX

   12119   4   2
User Avatar
Member
46 posts
Joined: Oct. 2019
Offline
hi,
I am wondering if the attached file is the correct way to proceed with scaling primitives.
I am using an Attribute Wrangle to define pscale attribute for each primitive. Then I am using a primitive node with Transform option that refers to @pscale in Scale Y.

Is it the correct way to scale my primitives?
Is there any way to not use the last Primitive Node with Transform option?

I mean having my “transformed” Primitive directly out of the Wrangle Attribute Node? I don't understand why the Wrangle attribute doesn't transform the geometry although I changed pscale value.

Thanks
Edited by tosiho19 - April 6, 2020 11:37:50

Attachments:
200406_001_Capture_001.PNG (442.3 KB)
200406_001_Capture_002.PNG (436.1 KB)
200406_001_TransformPrimitive PScale.hipnc (106.2 KB)

User Avatar
Member
209 posts
Joined: March 2018
Offline
Hey bro!
You can use scale attribute which Copy to Points SOP uses this attribute to scale your object in three axis independently.
HIP file attached!
Edited by N-G - April 6, 2020 12:44:40

Attachments:
200406_001_TransformPrimitive PScale FIXED.hipnc (110.4 KB)

User Avatar
Member
46 posts
Joined: Oct. 2019
Offline
Thanks @N-G,
What about if I want to scale after the delete node?
v@scale = set(1, scale, 1);
doesn't seem to work then. Only if I add another primitive node at the end..

Can I get my “transformed” Primitive directly out of the Wrangle Attribute Node? or do I always need to add the “Primitive” node at the end?
Edited by tosiho19 - April 6, 2020 22:11:12
User Avatar
Member
8785 posts
Joined: July 2007
Offline
creating f@pscale or v@scale attribute on packed primitives is not gona affect them, it's just gonna set that attribute value which is completely independent from transforms of packed primitives

to set transform of the packed primitive you can use setprimintrinsic() to set the value of “transform” intrinsic as matrix3
or you can use getpackedtransform() and setpackedtransform() functions

float scaley =rand(@primnum, seed)*scalar;
matrix transform = getpackedtransform(0, @primnum);
scale(transform, set(1, scaley, 1));
setpackedtransform(0, @primnum, transform);

or create matrix3 or matrix4 attribute contiaining transform you want to apply to points or primitives and then use Transform By Attribute SOP which will have advantage of applying such transform to all desired attributes according to their qualifiers
Tomas Slancik
FX Supervisor
Method Studios, NY
User Avatar
Member
46 posts
Joined: Oct. 2019
Offline
great! @tamte thanks for your help!
  • Quick Links