Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (739)
Games in Android Showcase (224)
games submitted by our members
Games in WIP (820)
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 649 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: 446



« 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:
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  
 
 

 
Ecumene (53 views)
2017-09-30 02:57:34

theagentd (76 views)
2017-09-26 18:23:31

cybrmynd (184 views)
2017-08-02 12:28:51

cybrmynd (182 views)
2017-08-02 12:19:43

cybrmynd (189 views)
2017-08-02 12:18:09

Sralse (198 views)
2017-07-25 17:13:48

Archive (747 views)
2017-04-27 17:45:51

buddyBro (881 views)
2017-04-05 03:38:00

CopyableCougar4 (1429 views)
2017-03-24 15:39:42

theagentd (1320 views)
2017-03-24 15:32:08
List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05

SF/X Libraries
by SkyAphid
2017-03-02 06:38:56

SF/X Libraries
by SkyAphid
2017-03-02 06:38:32

SF/X Libraries
by SkyAphid
2017-03-02 06:38:05

SF/X Libraries
by SkyAphid
2017-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
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!