# Trunc function- vex

## Recommended Posts

Hello

I am going through "The Joy of Vex" tutorials and I came across a problem. I am on Day 8 where he is talking about noises. http://www.tokeru.com/cgwiki/index.php?title=JoyOfVex8

I am on the last part where he gives the exercises but I can't get it to do what he is explaining.

Basically I am trying to make some blocky noise with a custom slider using the Trunc function as he states:

Can you make stepped noise? Blocky noise? Hint: When we did quantising in an earlier lesson we took our distance 'd' and trunc'd it to reduce its precision. Here, you'd want to copy @P to a temp vector pos, quantise it, and feed that result to noise (see gif below)

I get really close but I don't know how he is controlling it with a slider. My noise looks very faded and disapears after a certain value.

I am just trying to ahieve the same effect in the gif

I will attach my scene for anyone that wants to take a look

Thank you

trunc.hip

##### Share on other sites

Keep working at it. You'll get it.

Problems like these are work for the student to prove they've learned the material.

I spent a few minutes and think I got it, but I've got a dozen years plus of experience messing with these kind of things.

Also, you'll want to never have an integer multiply a vector assignment, there on the right side of the equation. It will turn your vector into a float. Also you want to declare your attributes with f,v,i,s for float, vector, integer, and string respectively.

```@Cd=noise(posQ*chf("freq"))*2;
//should be
v@Cd = noise(posQ*chf("freq"));
v@Cd *= 2;```

Do please spend at least another day or so at it before checking my hint below if you really really can't get it.

Try quantizing a transformation of your v@P before trunc, then transform back.

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

×   Pasted as rich text.   Paste as plain text instead

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×