woodenduck Posted September 9, 2018 Share Posted September 9, 2018 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 Quote Link to comment Share on other sites More sharing options...
anim Posted September 9, 2018 Share Posted September 9, 2018 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); } 1 Quote Link to comment Share on other sites More sharing options...
woodenduck Posted September 10, 2018 Author Share Posted September 10, 2018 Thanks Thomas, So if I understand you correctly, ptnum just needs to be initialised to some value, then fed in to the function and will automatically receive a value? Quote Link to comment Share on other sites More sharing options...
anim Posted September 10, 2018 Share Posted September 10, 2018 all arguments of a context level (shader) function have to be initialized with default value and yes, whatever program calls the CVEX shader function may pass some arguments Quote Link to comment Share on other sites More sharing options...
dariondanjou Posted August 23, 2019 Share Posted August 23, 2019 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? Quote Link to comment Share on other sites More sharing options...
anim Posted August 24, 2019 Share Posted August 24, 2019 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); 1 Quote Link to comment Share on other sites More sharing options...
fuat Posted August 25, 2019 Share Posted August 25, 2019 (edited) Tomas, your Houdini knowledge and numerous answers are truly amazing. Edited August 25, 2019 by fuat Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.