Fractal noise!

Blitz3D Forums/Blitz3D Userlibs/Fractal noise!

MusicianKool(Posted 2010) [#1]
This is to continue the discussion from the code archives. (it's very confusing there :( http://www.blitzbasic.com/codearcs/codearcs.php?code=2706 ) so long and no pages :( .

To download the Latest Lib (version Final): http://www.mediafire.com/?kwno5wnty4i

Please post your Fractal Noise algorithms here for others to use.
Thanks!


MusicianKool(Posted 2010) [#2]
ummm....


MusicianKool(Posted 2010) [#3]
Updated NoiseGens library, this is the final release. I cannot add any more to it. All examples should be clear, if not then I can help. There is a lot in this update. nothing new to the engine other then added the nameing conventions of Init_Noise(seed) or CreateNoiseGenerator(seed) to mean the same thing. As well as Free_Noise(NoiseID) or FreeNoiseGenerator(NoiseID) there are some simple math functions included within the Library it's self.

Have fun and enjoy


Mongoose(Posted 2013) [#4]
Amazing noise library! I've started using it to make a large, randomly generated world using all of the various noise functions. I posted it in another thread (http://blitzbasic.com/Community/posts.php?topic=99877#1174961) actually looking for help on it.

I'm curious if you have any plans to perhaps port this to Blitzmax? It would be infinitely useful- seeing as how Blitz3D is slowly becoming more and more antiquated as time goes on.


_PJ_(Posted 2015) [#5]
Is there a way to ensure that a noisemap will tile?

I am trying to generate textures for spheres (planets) procedurally based on the Perlin Noise function.

Perhaps Krischan may know the technique...

Function PerlinNoiseInitialisation(Seed%=0)
	If (Seed=0)
		Seed=MilliSecs()
	End If
	InitPerlinNoise(Seed)  
	Return Seed
End Function

Function PerlinNoiseMap(Size=128)
	Local Image=CreateImage(Size,Size)
	Local Buffer=ImageBuffer(Image)
	Local X
	Local Y
	
	Local aRGB#
	Local Component
	Local NoiseLevel#
	Local Resolution=Size*Size
	
	LockBuffer Buffer
	For Y = 0 To Size-1
		
		For X = 0 To Size-1
		
		
			NoiseLevel# = Perlin3D(X,Y,Size,Size,0,Resolution)
			If NoiseLevel# < 0 Then NoiseLevel# = 0
			If NoiseLevel# > 1 Then NoiseLevel# = 1
			Component=NoiseLevel# * 255
			aRGB = GetBGRa(Component,Component,Component)
			
			WritePixelFast X,Y,aRGB,Buffer
		Next
	Next 
	UnlockBuffer Buffer
	
	Return Image
	
End Function

Function GetBGRa(R,G,B,a=255)
	Return (B And 255) + ((G And 255) Shl 8)) + ((R And 255) Shl 16) + ((a And 255) Shl 24))
End Function

Function GetA(RGBa)
	Return (RGBa Shr 24)And 255
End Function

Function GetR(RGBa)
	Return (RGBa Shr 16)And 255
End Function

Function GetG(RGBa)
	Return (RGBa Shr 8)And 255
End Function

Function GetB(RGBa)
	Return RGBa And 255
End Function