Jump to content

Division in VEX expression in point node

Recommended Posts

Quick question, I was watching Jeff Wagner's webinar on the changes to nodes in 16 and at the 15:04 mark he starts discussing the new Point node. In the drop down options for the VEXpression field there are a number of options, such as Pass Through, Constant Value, etc. There is a Multiply by Constant Value but no Divide by, and if I try to write a VEXpression and use a division sign it does not seem to evaluate. For instance if I wanted to create a gradient of color along a line, I would try to use set(value.r + (@ptnum/@numpt), value.g, value.b) but I would just get values of 0,0,0 for every point. I can do the @ptnum/@numpt division in a separate Attribute Create node but not in the VEXpression field of the Point node itself. Can you not use division in VEXpressions?

Link to comment
Share on other sites

8 minutes ago, woodenduck said:

Have you tried casting @ptnum and @numpt to floats before dividing? 

(float)@ptnum / (float)@numpt 

I think VEX will treat them as integers and not divide correctly otherwise.

Brilliant, thank you, that worked out.

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.

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