How would you translate hscript expression into VEX?

   4232   1   0
User Avatar
Member
55 posts
Joined: July 2005
Offline
I am trying to get my head round VEX expression and found that there are hscript_noise, hscript_turb….etc. for noise that mimic hscript's noise function, for example. I did look up but I still don't quite understand how to “read” it…

And my question would be, what if the noise expression is a bit complicated like below, how would you translate it into VEX expression?

noise($TX * .2, $TY, $TZ * .5) + sturb($TX * .3, $TY, $TZ * noise($TX * .5, $TY, $TZ * .2), 5)

Or rather create a whole new version using VEX noise funcation?

Thanks!
User Avatar
Member
25 posts
Joined: Oct. 2012
Offline
The equivalent of the position of the current point is “@P” or just “P”. This is a vector but you can access individual components with “.x .y .z”, so P.x / P.y /P.z.

Most noise functions take a vector as an input so you can define your space deformation beforehand and then plug the new vector in the noise function. Your current expression could look something like this in vex:

vector space = set(P.x*.2,P.y,P.z*.5);
vector space2 = set(P.x*.5,P.y,P.z*.2);
vector space3 = set(P.x*.3,P.y,P.z*noise(space2));
vector noise = hscript_noise(space) + hscript_turb(space3,5);

P+= noise;

I think the hscript_* versions could easily be changed for the vex versions, just look at the help files if the particular noise function you are trying requires more arguments and also in which range it outputs!
  • Quick Links