Java-Gaming.org Hi !
 Featured games (91) games approved by the League of Dukes Games in Showcase (804) Games in Android Showcase (239) games submitted by our members Games in WIP (868) 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 8787 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: 796

 « 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

 Riven (579 views) 2019-09-04 15:33:17 hadezbladez (5501 views) 2018-11-16 13:46:03 hadezbladez (2398 views) 2018-11-16 13:41:33 hadezbladez (5761 views) 2018-11-16 13:35:35 hadezbladez (1220 views) 2018-11-16 13:32:03 EgonOlsen (4660 views) 2018-06-10 19:43:48 EgonOlsen (5681 views) 2018-06-10 19:43:44 EgonOlsen (3196 views) 2018-06-10 19:43:20 DesertCoockie (4094 views) 2018-05-13 18:23:11 nelsongames (5114 views) 2018-04-24 18:15:36
 princec 10x Ali-RS 6x philfrei 5x VaTTeRGeR 5x KaiHH 5x mudlee 5x elect 4x Rain8 3x SteveSmith 2x hansolo_ 2x gouessej 2x ral0r2 1x saocrinn 1x Akazan 1x Apo 1x
 A NON-ideal modular configuration for Eclipse with JavaFXby philfrei2019-12-19 19:35:12Java Gaming Resourcesby philfrei2019-05-14 16:15:13Deployment and Packagingby philfrei2019-05-08 15:15:36Deployment and Packagingby philfrei2019-05-08 15:13:34Deployment and Packagingby philfrei2019-02-17 20:25:53Deployment and Packagingby mudlee2018-08-22 18:09:50Java Gaming Resourcesby gouessej2018-08-22 08:19:41Deployment and Packagingby gouessej2018-08-22 08:04:08
 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