O'Reilly logo

Mastering openFrameworks: Creative Coding Demystified by Denis Perevalov

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Space-coherent noise

There are a number of overloaded ofNoise() functions that depend on two, three, or four parameters: ofNoise( x, y ), ofNoise( x, y, z ), and ofNoise( x, y, z, t ). They have behavior like ofNoise( t ) but use several input parameters. Their coordinates may be scaled as 2D or 3D space coordinates of some point and may even include time. So such functions give a way for generating 2D, 3D, and 4D fields with coherently changing values that are static or evolving with time. For example, the ofNoise( x, y ) function can be used for drawing a smooth random texture in the following way:

float scaleX = 0.007; //1.0 / scaleX is coherence in x float scaleY = 0.008; //1.0 / scaleY is coherence in y float posX0 = 593.2; float posY0 = 43.7; ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required