Jump to content
Sign in to follow this  
Lister

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?

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×