Java-Gaming.org Hi !
 Featured games (90) games approved by the League of Dukes Games in Showcase (731) Games in Android Showcase (217) games submitted by our members Games in WIP (798) games currently in development
 News: Read the Java Gaming Resources, or peek at the official Java tutorials
 Home Help Search Login Register
Pages: [1]
 ignore  |  Print
 [JOML] How to get multiple octaves of SimplexNoise?  (Read 222 times) 0 Members and 1 Guest are viewing this topic.
EnderNinja7_2

Junior Newbie

 « Posted 2017-06-15 09:30:55 »

The JOML SimplexNoise class gives a noise function for generating noise values. How do I compute this value and add multiple octaves of it to generate a variety of terrain?
KaiHH

JGO Kernel

Medals: 416

 « Reply #1 - Posted 2017-06-15 09:37:49 »

Exactly how you compute multiple octaves with any other base noise function:
You scale the input coordinates for the noise function and scale the output value, and do this for any number of octaves you want and accumulate the output values over all octaves.
philfrei
 « Reply #2 - Posted 2017-06-15 16:14:07 »

Is there a particular pattern you are going for?

With the more complex patterns, you have to make multiple calls to the simplex function for each pixel and combine them. Usually this is done with addition, where each octave is given its own weight. It is not necessary to do so, but usually folks scale the multiple calls via some sort of fractal relationship. For example, a nice cloud pattern can be had that way.

Pseudo code:
 1  2  3  4  5 `    noiseValue = simplex(x, y) / 2;    noiseValue += simplex(x * 2, y * 2) / 4;    noiseValue += simplex(x * 4, y * 4) / 8;    noiseValue += simplex(x * 8, y * 8) / 16;    etc.`

The results will range in between -1 and 1. You can then scale that to color values in various ways. Applying an ABS function to the result before scaling is an option that Ken Perlin called "turbulent" as opposed to "smooth".

Most importantly, for terrain, instead of scaling the noiseValue to a gradient of a color (as in Red in the range 0..255 or 0..1 depending on what command you are using), one uses a color mapping. I first read about this in a blog post by a jgo member @ShannonSmith
http://www.angryoctopus.co.nz/?p=11

We have a pretty good article here: http://www.java-gaming.org/topics/noise-bandpassed-white/27071/view.html

I made a 'visualizer' to help with playing around with different ratios and scalings using a GUI. It uses Gustafson's implementation of 2D simplex, but if you were to swap in another simplex function, the results should be similar. There is a link to a jar and the github site on this thread:
http://www.java-gaming.org/topics/sivi-2d-simplex-noise-visualizer-tool/30187/view.html
The html implementation link to the visualizer is obsolete.

As part of the visualizer tool, there is a 'gallery' of graphics that can be loaded and fiddled with. The input scalings are apparent (each channel column has fields where values are plugged in), but the "mixer" could be clearer in terms of letting you figure out what numbers to use to scale each output to get the visualized effect.

If I remember correctly, what is going on is this: the values shown on each octave slider are numerators and the sum of all the channels is the denominator. So, if one channel reads 24 and another reads 48, the ratio will be 24/72 and 48/72. There is also a total volume slider (bottom most) which scales everything equally. The display uses values that range 0..255, so if the highest value is 72, output to the graphic is on the low side. If the bottom slider is pushed to the right, it scales everything up by the same factor and can overflow beyond 255 (or be clamped at 255).

music and music apps: http://adonax.com
Pages: [1]
 ignore  |  Print

 Archive (336 views) 2017-04-27 17:45:51 buddyBro (535 views) 2017-04-05 03:38:00 CopyableCougar4 (978 views) 2017-03-24 15:39:42 theagentd (1014 views) 2017-03-24 15:32:08 Rule (993 views) 2017-03-19 12:43:22 Rule (973 views) 2017-03-19 12:42:17 Rule (971 views) 2017-03-19 12:36:21 theagentd (1071 views) 2017-03-16 05:07:07 theagentd (990 views) 2017-03-15 22:37:06 theagentd (760 views) 2017-03-15 22:32:18
 theagentd 13x orange451 13x philfrei 12x J0 10x Damocles 8x Coldstream24 7x Unimatrix325 7x KaiHH 7x Sickan 7x Guerra2442 7x Riven 7x 65K 4x Ecumene 4x VaTTeRGeR 4x Archive 4x Apo 4x
 List of Learning Resourcesby elect2017-03-13 14:05:44List of Learning Resourcesby elect2017-03-13 14:04:45SF/X Librariesby philfrei2017-03-02 08:45:19SF/X Librariesby philfrei2017-03-02 08:44:05SF/X Librariesby SkyAphid2017-03-02 06:38:56SF/X Librariesby SkyAphid2017-03-02 06:38:32SF/X Librariesby SkyAphid2017-03-02 06:38:05SF/X Librariesby SkyAphid2017-03-02 06:37:51
 java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org