Hey there guys.
Now what Houdini is starting to move away from using local variables, I am lost in how to achieve certain results.
So back in the old days( I still do it due to the old point node being available ), I would use the old point node, plug a point into input 1 and then another point into input 2. Then I would add a normal, and set the X to $TX2 - $TX, the Y to $TY2 - $TY, and $TZ2 - $TZ.
Now that Sidefx is pushing for vex ( which is a good idea to keep Houdini more focused and allow us to have faster executing networks), the old point node would now set the normal to @N.x, @N.y, @N.z instead of $NX, $NY and $NZ
So my question is….
How would I convert $TX2 - $TX into vex to set the normal direction like I used to?
vex instead of local variables
6706 8 1- Martin Krol
- Member
- 25 posts
- Joined: Jan. 2014
- Offline
- dkzone
- Member
- 23 posts
- Joined: Feb. 2014
- Offline
- sakeating
- Staff
- 107 posts
- Joined: Feb. 2009
- Offline
Martin Krol
Hey there guys.
Now what Houdini is starting to move away from using local variables, I am lost in how to achieve certain results.
So back in the old days( I still do it due to the old point node being available ), I would use the old point node, plug a point into input 1 and then another point into input 2. Then I would add a normal, and set the X to $TX2 - $TX, the Y to $TY2 - $TY, and $TZ2 - $TZ.
Now that Sidefx is pushing for vex ( which is a good idea to keep Houdini more focused and allow us to have faster executing networks), the old point node would now set the normal to @N.x, @N.y, @N.z instead of $NX, $NY and $NZ
So my question is….
How would I convert $TX2 - $TX into vex to set the normal direction like I used to?
In the new Point Sop ( Attribute expression sop ), set the ‘attribute’ parameter to N and then in the VEXpression field enter :
v@opinput1_P - v@P
You can use the “opinput_” to fetch attributes from other inputs. This works in wrangles, etc.
—————-
Scott Keating
Product Designer
SideFX Software
—————-
Scott Keating
Product Designer
SideFX Software
—————-
- Felix6699
- Member
- 45 posts
- Joined: Aug. 2012
- Offline
sakeatingHello, this is great, but can we see it all in help docs? Example: before/after.
In the new Point Sop ( Attribute expression sop ), set the ‘attribute’ parameter to N and then in the VEXpression field enter :
v@opinput1_P - v@P
You can use the “opinput_” to fetch attributes from other inputs. This works in wrangles, etc.
Edited by Felix6699 - April 28, 2017 10:36:02
- Martin Krol
- Member
- 25 posts
- Joined: Jan. 2014
- Offline
sakeating
v@opinput1_P - v@P
Thank you for the answer.
Just so I try to understand what this all means. Would you mind if I ask what it all means? or how I should interpret it logically?
v@opinput1_P - v@P
so how I am reading it is: vector attribute of operator input 1s position - vector attribute position?
So you don't have to specify the second input directly?
The local variables seemed logical $TX2 - $TX
kinda like using ch(“../node2/tx”) - ch(“../node1/tx”)
Originally I was expecting to use (@N2.x or @N.x2) - @N.x but this didnt get me anything.
( I apologize ahead of time, I am not a programmer and I am trying to make sense of all of this )
- mestela
- Member
- 1798 posts
- Joined: May 2006
- Online
Yep. More a a breakdown, might help or hinder, apologies in advance.
@ is prefix for attribute
@P is the position attribute of a point
@N is the normal attribute of a point
Because attributes can have different types (vector, float, int etc), there are prefixes to denote what you're talking about:
The 4 inputs of a wrangle are numbered 0,1,2,3. If you wanted to refer to the @P from input 1, you put opinput1_ between the @ and P, like this:
So if you wanted to be super canonical, to get position from the 0 input, you'd specify its a vector, the 0 input, and the P attribute:
In practice there's a few shortcuts you can take. Vex knows about frequently used attributes like P, N, Cd, so they don't need the type prefix. Also, if you don't specify the ‘opinput_n’ bit, it pulls from the 0 input. This is why can you just write
So in your case, you want to set N based on the input-0 point minus the input-1 point. In a wrangle, you write that pretty much as that sentence flows, first being all super canonical and smug coder:
and again being lazy coder; we don't need the type prefix (tho its a good habit to get into), and we don't need to specify opinput0_, as that'll be assumed. So that shortens to
Hope that helps!
-matt
@ is prefix for attribute
@P is the position attribute of a point
@N is the normal attribute of a point
Because attributes can have different types (vector, float, int etc), there are prefixes to denote what you're talking about:
v@foo; // means @foo is a vector i@bar; // means @bar is a integer f@grep; // means @grep is a float
The 4 inputs of a wrangle are numbered 0,1,2,3. If you wanted to refer to the @P from input 1, you put opinput1_ between the @ and P, like this:
@opinput1_P
So if you wanted to be super canonical, to get position from the 0 input, you'd specify its a vector, the 0 input, and the P attribute:
v@opinput0_P
In practice there's a few shortcuts you can take. Vex knows about frequently used attributes like P, N, Cd, so they don't need the type prefix. Also, if you don't specify the ‘opinput_n’ bit, it pulls from the 0 input. This is why can you just write
@P
So in your case, you want to set N based on the input-0 point minus the input-1 point. In a wrangle, you write that pretty much as that sentence flows, first being all super canonical and smug coder:
v@opinput0_N = v@opinput0_P - v@opinput1_P;
and again being lazy coder; we don't need the type prefix (tho its a good habit to get into), and we don't need to specify opinput0_, as that'll be assumed. So that shortens to
@N = @P - @opinput1_P;
Hope that helps!
-matt
Edited by mestela - April 28, 2017 11:18:53
- Martin Krol
- Member
- 25 posts
- Joined: Jan. 2014
- Offline
- Felix6699
- Member
- 45 posts
- Joined: Aug. 2012
- Offline
- mchaput
- Staff
- 503 posts
- Joined: July 2005
- Offline
The page you want is https://www.sidefx.com/docs/houdini/vex/snippets. [sidefx.com] I will try to make the links to that page from the nodes more prominent.
-
- Quick Links