Live data from Hacker News

Fractional Brownian Motion for Terrain Generation

iquilezles.org

21–29 of 29 posts

Re: Fractional Brownian Motion for Terrain Generation

#21
Someone check my understanding here:

>If the memory is negatively correlated, a positive change will be most likely followed by a negative change, and the path will be much more random.

Wouldn't the path be less random because you're introducing constraints? Perhaps a better phrasing would be "the path will be much more variable"?

Re: Fractional Brownian Motion for Terrain Generation

#22

The code examples have me confused because they return a single sample at a time, but if noise is to have the kind of different characteristics discussed at different scales, individual sample values cannot be independent of previous sample values. I guess the provided code examples must return values which are ordered somehow by properties of the `noise` function, which must involve some memory of previously given v…

You missed that the noise function is given n-dimensional coordinates as an argument. Rather than picturing an RNG, you can think of it as a texture unit that samples from an n-dimensional image of some noise with certain characteristics.

The order in which sample values are retrieved doesn't matter — of course it doesn't! It's important that fragments (think 'pixels' in case you're wondering what fragments are) can be evaluated independently and in any order, as computing fragments is supposed to be a massively parallel operation.

It this context, you have to throw out the concept of 'previous' sample values and replace it with 'nearby' values.

Re: Fractional Brownian Motion for Terrain Generation

#23
post #22

The code examples have me confused because they return a single sample at a time, but if noise is to have the kind of different characteristics discussed at different scales, individual sample values cannot be independent of previous sample values. I guess the provided code examples must return values which are ordered somehow by properties of the `noise` function, which must involve some memory of previously given v…

You missed that the noise function is given n-dimensional coordinates as an argument. Rather than picturing an RNG, you can think of it as a texture unit that samples from an n-dimensional image of some noise with certain characteristics. The order in which sample values are retrieved doesn't matter — of course it doesn't! It's important that fragments (think 'pixels' in case you're wondering what fragments are) can…

Thanks, I wasn't clear on what that vector f*x was. So the noise function is mapping pattern values to coordinates, and the SBM function is combining/layering its patterns calculated with different powers at different scales.

Still on the face of it that advice "the choice of noise function doesn't matter much" is tricky, considering "white noise" is mentioned in the intro which takes no coordinates, but white noise walks of different scales can be combined I think to produce a non-white noise walk.

Besides this combining in a loop the same kind of noise/texture with different power over different scales, I would be interested in also varying the kinds of texture that are layered into different scales.

Re: Fractional Brownian Motion for Terrain Generation

#24
Was interesting but a bit over my head honestly. However, I just wanted to make sure no one missed the demo that was linked, because I almost missed it: https://www.shadertoy.com/view/4ttSWf

It's a terrain + trees and other stuff written in about 1000 lines as a shader, using the algorithm described in the article.

Re: Fractional Brownian Motion for Terrain Generation

#25

If you ever need to produce a bunch of FBM or other noise on the cpu fast, these two libraries are handy. They use SIMD instructions to make noise ~3x to ~7x faster than usual. C++: https://github.com/Auburns/FastNoiseSIMD Rust: https://github.com/jackmott/rust-simd-noise

For truly high-resolution grids (or big ones I guess), would be nice if it could be generated via GPU.

Re: Fractional Brownian Motion for Terrain Generation

#28

Earlier quoted context omitted.

yes but i'm asking about what you were really trying to say - are you trying to say one can generate these textures by specifying a filter (transfer function or whatever you want to call it) with a random phase component? and then take ifft to get the definition in space?

If I understand this correctly, it's not even a matter of using a filter, just a case of summing some random sinusoids with an appropriate weighting for each according to the frequency. You can do this by starting off with noise in the frequency domain and shaping it before doing an iFFT.

Yes, I meant exactly that. You build a spectrum by setting the amplitudes to the desired decay law, and the phases to random. It is an octave/matlab one-liner.

Re: Fractional Brownian Motion for Terrain Generation

#29
post #9

If anyone isn't aware of who Iniqo Quilez is, then explore the entire site and follow it up by looking at his work over at Shadertoy (username: iq) and any of his demoscene contributions at http://www.pouet.net and maybe read this fascinating article about his work with Pixar on Brave: http://www.cgw.com/Publications/CGW/2012/Volume-35-Issue-4-J...

Note that Shadertoy could very well crash your browser.

I really wish that their search page had a static thumbnail image version - or if it does, that I could find it.
Post reply on HN