Jump to content

How to use Vex with particles?


Yorkst

Recommended Posts

1)What are VEX attributes available to node?

When I middle-click POP kill node, it displays

 

p@P

@age

i@dead

i@has_previous

i@id

@life

v@previous

i@sourceptnum

v@v

 

I also can use a random name in VEX expression:

 

dead = i@fnjfrjrjnjn;

 

It will compile and be set to zero.

 

But

i@ptnum attribute is not zero and equals to id probably equals to HScript $PT. Spreadsheet also doesn't list it. Where does it come from?

 

2)What do VEX variables represent?

I found @ptnum here: https://web.archive.org/web/20150203054824/http://www.sidefx.com/docs/houdini14.0/vex/snippets

 

It is the only place in the docs, where it's mentioned.

 

I can understand meaning of some of variables from name, but is there a reference? What are @dPdz, @backtrack, @orient?

Edited by Yorkst
Link to comment
Share on other sites

Omitting plenty of disturbing details,

 

1) All node's attributes can be acessed using expressions.

 

1.1) In Wrangle or VOP nodes all node's attributes available, plus all global variables existing in VOP network for this geometry (wrangles are assets with corresponding vopnet nodes inside) are available too. To understand what you can access in Point Wrangle, for example, MMB on geometry and see what attributes are there, then drop Point VOP and see what variables provided by Geometry VOP Global Parameters node. Note that some of them still required to be computed by user, otherwise they will return something default, like zeros for @Cd, -1 for @id or fresh computed normal for @N.

dead = i@fnjfrjrjnjn;

This automatically creates attribute with zero as default, then assigns it's value to variable dead.

 

2) Global variables defined for each context. Besides help, there is nice VCC command for exact context info (that one for cvex):

vcc --list-context cvex

Actually, cvex is a poor one who has no global variables defined. However, there are still globals presented in cvex's vopnets, but instead of atomic Global Variables node there is an asset called Geometry VOP Global Parameters  with bunch of Parameter nodes inside, which is the way you can access any arbitrary attribute on geometry. So, all globals are sitting somewhere or computed automatically. Maybe VCC checks for special names like "N" or "OpInput2" and tells Houdini to pre-compute normals if they are not exist and make operator path of second input. There is no anything special about it in generated VEX code, so, when this code compiles, normals already had pre-computed.

 

HScript's $PT may have similar value as ptnum, but it is local variable, a different thing. They defined only for certain nodes (they are local) and don't exist everywhere.

Edited by f1480187
Link to comment
Share on other sites

Thank you for the detailed description, f1480187!

 

Didn't find the link with contexts by typing "ptnum" in built-in search.

 

@marles

Yes. The link in previous post plus help for each reference seem to cover most of it. What about @backtrack and @orient? Are those locals?

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...