JoyOfVex8

Noise, various types, how it can be scaled, vector vs scalar noise, why you might use vops here instead

Noise

One of the most common things you'll do is require procedural noise. This is simple to do:

``` @Cd = noise(@P);
```

To change the scale of noise, multiply @P by a factor:

``` @Cd = noise(@P*ch('scale'));
```

Or if you want non-linear noise, multiply it by a vector:

``` @Cd = noise(@P*chv('fancyscale'));
```

If you want to move noise around, add an offset:

``` @Cd = noise(@P+chv('offset'));
```

Or if you want it animated, give it an animating value, like @Time:

``` @Cd = noise(@P+@Time);
```

Or combine all those things:

```  @Cd = noise(chv('offset')+@P*chv('fancyscale')+@Time);
```

Houdini offers quite a few types of noise, a common alternative is curlnoise:

```  @Cd = curlnoise(@P*chv('fancyscale')+@Time);
```

While most formats of noise will be happy with a single input, the more advanced noise types take lots of inputs to control their behavior. Eg, this is the help definition for pnoise:

``` pnoise(vector4 xyzt, int px, int py, int pz, int pt);
```

In these situations, especially if you want to quickly experiment with different kinds of noise, vops can be the faster option. You might want to combine noise with patterns, or do more freeform experiments with the noise attributes, definitely worth using vops as a sketch pad for this kind of thing.

All the examples so far generate vector noise (you can see that cos when its output to @Cd, its all multicoloured and interesting). For the most part you can assign these directly to a scalar value, and vex won't complain much:

``` @Cd = 0;
@Cd.x = curlnoise(@P*chv('fancyscale')+@Time);
```

Exercises

1. How does this look when setting @P rather than @Cd?
2. Can you make a plane look like water? Like curtains? Like lumpy ground?
3. What happens when you fit the values? Clamp? Run through a ramp?
4. 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)
5. What happens if you drive noise from a length function? From distance to a pig as the second input?
6. stepped distance to the pig, driving noise, moving along @N?

prev: JoyOfVex7 this: JoyOfVex8 next: JoyOfVex9