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 8791 times)
0 Members and 1 Guest are viewing this topic.
Offline 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?
Offline 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.
Offline 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:
    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;

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

We have a pretty good article here:

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:
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:
Pages: [1]
  ignore  |  Print  

Riven (581 views)
2019-09-04 15:33:17

hadezbladez (5509 views)
2018-11-16 13:46:03

hadezbladez (2402 views)
2018-11-16 13:41:33

hadezbladez (5771 views)
2018-11-16 13:35:35

hadezbladez (1223 views)
2018-11-16 13:32:03

EgonOlsen (4661 views)
2018-06-10 19:43:48

EgonOlsen (5682 views)
2018-06-10 19:43:44

EgonOlsen (3197 views)
2018-06-10 19:43:20

DesertCoockie (4095 views)
2018-05-13 18:23:11

nelsongames (5115 views)
2018-04-24 18:15:36
A NON-ideal modular configuration for Eclipse with JavaFX
by philfrei
2019-12-19 19:35:12

Java Gaming Resources
by philfrei
2019-05-14 16:15:13

Deployment and Packaging
by philfrei
2019-05-08 15:15:36

Deployment and Packaging
by philfrei
2019-05-08 15:13:34

Deployment and Packaging
by philfrei
2019-02-17 20:25:53

Deployment and Packaging
by mudlee
2018-08-22 18:09:50

Java Gaming Resources
by gouessej
2018-08-22 08:19:41

Deployment and Packaging
by gouessej
2018-08-22 08:04:08 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‑
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!