Procedural Texture Creation

BlitzMax Forums/BlitzMax Programming/Procedural Texture Creation

SillyPutty(Posted 2005) [#1]
Hi all, I would like to create some textures with noise, for instance clouds and fire textures.

How would one do this ? As in the algorithm for it ?

How would one also blur the image to take away hard edges ?


Booticus(Posted 2005) [#2]
http://www.blitzmax.com/codearcs/codearcs.php?code=1420

That was done by impixi, not by me. I just posted the code. Its pretty dang awesome. It also has a "smooth" algorithm in it too. So check it!! Windows only I think...but try it anyways!


SillyPutty(Posted 2005) [#3]
ah thanks so much !!!


SillyPutty(Posted 2005) [#4]
woah that is hectic code eh ? ehehe

I basically just wanted to create a "smoke" texture and smoothen it, anyone got any less hairy code ?

if not, tis cool, I will try and scrutinize the code.


SillyPutty(Posted 2005) [#5]
ok basically, it is just the result of the code below that I would like to smooth, so that I have a basic cloud texture, is there an "easier" way of doing this ?




Dubious Drewski(Posted 2005) [#6]
I don't know procedural algorithms, but if you want a simple blur, this is how I'd do it. With arrays.

Graphics 640,480,0

SeedRnd(MilliSecs())
Global matrixX=300,matrixY=300
Local matrix[matrixX+2,matrixY+2]

For Local i:Int = 0 To 10000
Local ang:Int = Rnd(360)
Local rad:Int = Rnd(70)+Rnd(40)
Local x:Int = Cos(ang)*rad
Local Y:Int = Sin(ang)*rad
matrix [x+110,y+110] = Rand(100,255) 'instead of Plot
Next
blurMatrix matrix, 20
drawMatrix matrix,100,100
Flip

WaitKey

Function blurMatrix (matrix[,],times)
For Local a = 1 To times
For Local y = 1 To matrixY
For Local x = 1 To matrixX
Local c = matrix[x,y]+matrix[x+1,y]+matrix[x-1,y]+matrix[x,y+1]+matrix[x,y-1]
c:*.2
matrix[x,y]=c
Next
Next
Next
End Function

Function drawMatrix(Matrix[,],xPos,yPos)
For Local y = 0 To matrixY
For Local x = 0 To matrixX
SetColor matrix[x,y],matrix[x,y],matrix[x,y]
Plot xPos+x,yPos+y
Next
Next
End Function


Dubious Drewski(Posted 2005) [#7]
How do you fellows make those scrollable boxes? I tried to copy the page source for the above example, but to no avail.

Curse my lack of interest in html!


SillyPutty(Posted 2005) [#8]
dude !!!!!!

that is exactly what I needed !

Thanks so much, you rock !