Hey gang,

How would you recreate the effects of noiseDetail for graphics in processing, but using openFrameworks?

Any help appreciated.

Thanks,

James

Hey gang,

How would you recreate the effects of noiseDetail for graphics in processing, but using openFrameworks?

Any help appreciated.

Thanks,

James

Hi RaCompTeur,

Your question interest me so Iâ€™ve just done some researches and tries that I can share.

First Iâ€™ve read the ofNoise code. The comments says:

This implementation is â€śSimplex Noiseâ€ť as presented by Ken Perlin [â€¦]

Iâ€™ve read that *Simplex noise* is an improved version of *Perlin noise*, and that they are gradient smooth functions. To create a more fractal noise, a common practice is to layer multiple perlin (or simplex) noise at different amplitudes and frequencies, which are the â€śoctavesâ€ť youâ€™re looking for. Here is a nice article about this.

It seems a little bit strange to me that Iâ€™ve found nothing about fractal noise in the OF core nor in the OF addons. Perhaps Iâ€™m missing something. A research about this topic in the forum lead to shader implementations, and this is probably a common use case, because CPU computation can be too slow in many cases.

Anyway, I made a CPU function that compute octaves noise (I just had to port the code from this neat page to OF):

```
float octavePerlin( float x, float y, float z, int octaves, float persistence )
{
float total = 0 ;
float frequency = 1 ;
float amplitude = 1 ;
float maxValue = 0 ;
for( int i = 0 ; i < octaves ; i++ )
{
total += ofNoise( x * frequency, y * frequency, z * frequency ) * amplitude ;
maxValue += amplitude ;
amplitude *= persistence ;
frequency *= 2 ;
}
return total / maxValue ;
}
```

Hereâ€™s a demo application: octave-noise.zip (2,2 Ko)

I think the `octave`

and `persistence`

parameters have got the same effect that the `lod`

and `falloff`

parameters for the processing `noiseDetail()`

function.

The zip also contains a class that can be used like that:

```
OctaveNoise noise ;
noise.setup( 8, 0.5f ) ; // p5 noiseDetail() like
float value = noise.get( 140.f, 20.f ); // 2D noise
```

3 Likes

hello,

Iâ€™m sorry, but where do I get noise shaders, that are used in your code ?

```
noiseShader[0].load("shaders/vertex.vert", "shaders/classicnoise2D.frag");
noiseShader[1].load("shaders/vertex.vert", "shaders/classicnoise3D.frag");
noiseShader[2].load("shaders/vertex.vert", "shaders/classicnoise4D.frag");
noiseShader[3].load("shaders/vertex.vert", "shaders/classicnoise2D.frag");
noiseShader[4].load("shaders/vertex.vert", "shaders/classicnoise3D.frag");
noiseShader[5].load("shaders/vertex.vert", "shaders/classicnoise4D.frag");
noiseShader[6].load("shaders/vertex.vert", "shaders/noise2D.frag");
noiseShader[7].load("shaders/vertex.vert", "shaders/noise3D.frag");
noiseShader[8].load("shaders/vertex.vert", "shaders/noise4D.frag");
```

Thanks

M

Hey @SFR75 , I posted in your other thread. Iâ€™d bet these files came from the ashima arts or similar.

wellâ€¦ I see a bunch of .glsl with matching filenames, but no .fragsâ€¦

and no vertex.vert file either.