Hello to all,
Here is a little demo of the love.math.noise function to generate background images. (left/right arrow to rotate, space to regenerate background)
Because I use scrolling, I need seemless image that I generate with the 3D noise function mapping the 2D surface on a donut that can create some stretching. I use a multi-octave noise (4 octaves) to have a 'pink noise' that seems more 'natural'.
A problem that I have is that the noise function use the same permutation and it is unable to define this permutation (and to change it) then to have different image, I use different origin, I don't know if another method can be used to do this.
Enjoy !
A little demo of love.math.noise function
A little demo of love.math.noise function
- Attachments
-
- testnoise.love
- (8.23 KiB) Downloaded 409 times
Re: A little demo of love.math.noise function
Cool. Thanks for sharing.
Check out my blog on gamedev
-
- Party member
- Posts: 712
- Joined: Fri Jun 22, 2012 4:54 pm
- Contact:
Re: A little demo of love.math.noise function
I think using a different origin is perfectly fine - it's the way I'd do it as well. The noise function doesn't come with a "seed" value, so I think using a random origin is the way to go...
trAInsported - Write AI to control your trains
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de
Bandana (Dev blog) - Platformer featuring an awesome little ninja by Micha and me
GridCars - Our jam entry for LD31
Germanunkol.de
Re: A little demo of love.math.noise function
I just played a little bit with the noise. To randomize it, I see two possible solutions. Either move the origin:
or introduce an additional dimension and pass a random number as additional argument:
Both give similar behavior.
Here is an example for the latter one. Press any button to generate noise with a new "seed".
Code: Select all
origin = math.random()*100
noiseDataAtX = love.math.noise(x-origin)
Code: Select all
seed = math.random()*100
noiseDataAtX = love.math.noise(x,seed)
Here is an example for the latter one. Press any button to generate noise with a new "seed".
- Attachments
-
- randomizeNoise.love
- (389 Bytes) Downloaded 170 times
Check out my blog on gamedev
Re: A little demo of love.math.noise function
Thank you for your feedbacks and advice.
I don't think to use another dimension, thank micha, but the problem is that noise computation because slower (not so critical as for perlin noise, because simplex has been created to avoid explosion of computation time when the number of dimension increases).
Because I experiment in the noise usage, I post here another demo about planet 'avatar' in a space game for example.
Planet is without cloud here (I'm lazy, sorry), and with a random rotation (WARNING ! this code contains matrix porn).
The light comes from a very far star, and is the same for all planet. I use no shader (all is computed in the sprite).
Press [space] to regenerate planets.
An image And the love file :
Enjoy !
I don't think to use another dimension, thank micha, but the problem is that noise computation because slower (not so critical as for perlin noise, because simplex has been created to avoid explosion of computation time when the number of dimension increases).
Because I experiment in the noise usage, I post here another demo about planet 'avatar' in a space game for example.
Planet is without cloud here (I'm lazy, sorry), and with a random rotation (WARNING ! this code contains matrix porn).
The light comes from a very far star, and is the same for all planet. I use no shader (all is computed in the sprite).
Press [space] to regenerate planets.
An image And the love file :
Enjoy !
- DaedalusYoung
- Party member
- Posts: 413
- Joined: Sun Jul 14, 2013 8:04 pm
Re: A little demo of love.math.noise function
You cannot do that when you're using all 4 dimensions in order to get seamless noise though, since love.math.noise only accepts up to 4 dimensions, so then the only way to go is the origin method.micha wrote:number as additional argument:Code: Select all
seed = math.random()*100 noiseDataAtX = love.math.noise(x,seed)
Who is online
Users browsing this forum: MSN [Bot] and 1 guest