Jump to content

Sop vex ptnum vs cvex


woodenduck

Recommended Posts

Hi, 

So in days of old when you used to create a Sop Vex Geometry Type Operator you had access to ptnum as a read-only global variable. Now if I try that in a cvex operator I get "Error 1067: Reference to undefined variable: ptnum". 

What is the current method for getting the current point number in the cvex context?

Cheers, 

WD

Link to comment
Share on other sites

in CVEX you define it as an argument and if it's fed to the shader it will be automatically populated, so in most geometry CVEX contexts it will contain actual ptnum in others like lens CVEX shader it will stay the default value (in this case 0) etc.

cvex
randomshader(int ptnum = 0; export vector Cd = { 0, 0, 0 })
{
    Cd = random(ptnum);
}

 

  • Thanks 1
Link to comment
Share on other sites

  • 11 months later...

i don't understand. does anyone mind showing an example of what i need to type in to get the point values to show up? i'm following an older "beginner's" tutorial that has me write the following into VEXpression of my point wrangle node: @scale = set(1, random(ptnum*321.45)*2-1, 1);

but I'm using Houdini 17.5 and it's giving me the error "reference to undefined variable: ptnum"

what is the newer version of the expression?

Link to comment
Share on other sites

this is not exactly the correct thread for it

the original question was about the full definition of the cvex shader vs older context specific sop vex shader

 

in VEXpressions of most Wrangles and other nodes you are not typing the full shader, rather snippet and rather than using pure VEX you have some extra syntax  like binding operator @ that will help houdini to build the shader code properly

so by binding the ptnum using @ptnum it will generate the arguments of the shader function as well as use ptnum in the code automatically 

so in your case the code will be

@scale = set(1, random(@ptnum*321.45)*2-1, 1);

 

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