Jump to content
Sign in to follow this  
Alexanrus

Vex anoise

Recommended Posts

Hi guys

I can't understood how does work a vex anoise. Is it a bug or my mistake. At the picture a simple code with result. Noise added just to first component of the vector. Usually Im work in vop but sometimes need write in vex and there another result

https://imgur.com/YU2stZN

Share this post


Link to post
Share on other sites

That looks like it should work. But... I find VEX a little tricky with multiplying vectors by floats. It doesn't like to do that right after a function. I suggest assigning the noise to the variable and then in another line multiplying the vector by your float amp. Like:

float amp = 4;
vector noise1 = anoise(v@P);
noise1 *= amp

 

  • Like 2

Share this post


Link to post
Share on other sites
57 minutes ago, kleer001 said:

That looks like it should work. But... I find VEX a little tricky with multiplying vectors by floats. It doesn't like to do that right after a function. I suggest assigning the noise to the variable and then in another line multiplying the vector by your float amp. Like:


float amp = 4;
vector noise1 = anoise(v@P);
noise1 *= amp

Thanks it's working

 

Share this post


Link to post
Share on other sites

when you have vex functions that can output different types, its always a good idea to cast them directly

for example, if you want a random greyscale color, based on the position:

v@Cd = float(rand(v@P)); // this will cast it back to a vector in the end, with the same value for all components.

v@Cd = rand(v@P); // this will cast it back to a vector in the end, but with different values for the components.

 

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  

×