Jump to content
Sign in to follow this  
kiryha

Get one component of vector in VEX expressions

Recommended Posts

How to get P.y only in such VES expression:

point("../nodeName/", 0, 'P',0)

 

Share this post


Link to post
Share on other sites
point("../nodeName/", 0, 'P',1)
  • Like 1

Share this post


Link to post
Share on other sites

So... it is not a VEX expression, but Hscript? Can not find docs for it...

Share this post


Link to post
Share on other sites

point expression function

Returns the value of a point attribute.

Replaced by

hou.Geometry.iterPoints()

hou.Point.attribValue()

 

point(surface_node, point_number, attribute, index)

surface_node is a path to a surface node, for example "/obj/geo1/grid1".

point_number is the point number to read the attribute from. When instancing, you can use instancepoint to get the number of the point currently being instanced.

attribute is the name of the attribute (for example, Cd for diffuse color). Two special attributes exist: P and Pw which represent the position of the point in space (Pw allows you to access the W component of the position).

index specifies the component position in multi-component attributes such as vectors, colors, and arrays. For example, if the attribute is a color, an index value of 0 returns the red component, 1 returns the green component, and 2 returns the blue component.

Note

This function will interpolate between point values if the point number is fractional, such as 3.35

EXAMPLES

point("/obj/geo1/facet1", 3, "P", 0)

Returns the X component of point 3 of the facet1 surface node in geo1.

point("/obj/geo1/facet1", 3, "N", 2)

Returns the Z component of the normal attribute of point 3 in the

 

  • Like 1

Share this post


Link to post
Share on other sites
On 1/30/2019 at 11:19 AM, kiryha said:

So... it is not a VEX expression, but Hscript? Can not find docs for it...

getcomp(vector(point(1,"P",@ptnum)),1)

Should works

Edited by MagicRej

Share this post


Link to post
Share on other sites

How can I define the object to grab attributes from in this case?

Share this post


Link to post
Share on other sites
On 30.01.2019 at 4:58 AM, kiryha said:

How to get P.y only in such VES expression:


point("../nodeName/", 0, 'P',0)

 

In which node are you going to use this? And for the sake of clarity: are you asking for vex or hscript solution?

  • Like 1

Share this post


Link to post
Share on other sites

In this case, I was talking about expression in the  UI parameter (to set tx in transform sop from some attribute of some node in the scene, for example).

And I am confused about this, how does it called (parameter expressions?) and which language is used here (Hscript or VEX)...

param_expression_01.PNG

Share this post


Link to post
Share on other sites

In help it is calling hscript expressions, and it usually compute value in parameters

in case with transform sop as Noobini said above you should use point expression. For convenience you can use spare input.

Pic_01.jpg.12af008981a0a1307794ff5dd02fab15.jpg

in case with scatter sop if you want use @Cd for scattering uncheck Force Total Count and control density with Density Scale parameter

  • Like 1

Share this post


Link to post
Share on other sites

In translate X expression

point(-1, 0,  "P", 1)

The second argument (0) is a Spare Input 0 reference? What is -1?

Share this post


Link to post
Share on other sites
10 hours ago, kiryha said:

In translate X expression


point(-1, 0,  "P", 1)

The second argument (0) is a Spare Input 0 reference? What is -1?

It is point expression function http://www.sidefx.com/docs/houdini/expressions/point.html

At the first place in this function you should put number of spare input instead of a path of surface node. Just drag and drop a node from Network View to a field of spare input in Parameters tab and you get a path of this node. As spare inputs may be more then one so Spare Input 0 has number of input -1, Spare Input 1 has number of input -2 and so on

Edited by vicvvsh
  • Like 1

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×