The coding train explores topics ranging from basic mathematics and physics concepts to more advanced simulations of complex systems. Subjects covered include physics simulation, trigonometry, self-organization, genetic algorithms, and neural networks. Examples are demonstrated in JavaScript using p5.js.
- noise() vs random()
- Graphing 1D Perlin Noise
- 2D Noise# Nature of Code The coding train explores topics ranging from basic mathematics and physics concepts to more advanced simulations of complex systems. Subjects covered include physics simulation, trigonometry, self-organization, genetic algorithms, and neural networks. Examples are demonstrated in JavaScript using p5.js.
- noise() vs random()
- Graphing 1D Perlin Noise
- 2D Noise
- noiseDetail()
- Coding Chalange: Random Walker
It was invented By Ken Perlin in the 1980s is mostly used in graphical applications to produce textures, natural motion, shapes, terrains etc.
Perlin Noise returns Perlin noise value at specific coordinates.
Perlin Noise is a random sequence generator producing a more natural ordered, harmonic succession of numbers compared to random() funciton.
2D perlin noise visulisation can be used for producing textures or terrains for different purposses. the picture from bellow is reult of implementing 2 dimensional Perlin noise. Since perlin noise is 'smooth randomness' and we are giving values to each pixel from gray to black we get cloudy texture look like drawing.
what does noiseDeatil() do?
- noiseDetail() takes two arguments.
- first argument is controling number of octives.the higher the number the finer details get on teh canvas.
- Lower octaves contribute more to the output signal and as such define the overall intensity of the noise, whereas higher octaves create finer grained details in the noise sequence.
- By default, noise is computed over 4 octaves with each octave contributing exactly half than its predecessor, starting at 50% strength for the 1st octave.
- second argument is usually is reffered as falloff
- This falloff amount can be changed by adding an additional function parameter.
- Eg. a falloff factor of 0.75 means each octave will now have 75% impact (25% less) of the previous lower octave. Any value between 0.0 and 1.0 is valid, however note that values greater than 0.5 might result in greater than 1.0 values returned by noise().
- By changing these parameters, the signal created by the noise() function can be adapted to fit very specific needs and characteristics.
- the point gets collored randomly using perlin noise algorithm
- Create a random walker with dynamic probabilities.
For example, it has a 50% chance of moving in the direction of the mouse
- instead of pixels we should use vectors.
- Instead of giving each pixel a vector we are gonna give a vector to every 20th pixel
- noiseDetail()