Jump to content

Get one component of vector in VEX expressions


kiryha

Recommended Posts

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
Link to comment
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

Link to comment
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
Link to comment
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
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...