Smoothing Terrains???

Blitz3D Forums/Blitz3D Programming/Smoothing Terrains???

The forum is locked. These are the original blitzbasic.com forums, kept so they can still be read. No new topics, replies or edits can be made here. To join in, head over to the Blitz3D+ forums.

basic blur algo off the top of my head and psudeo-code ish:

blur=1
for xpos=0 to size
for ypos=0 to size

total#=0
for x=-blur to blur
for y=-blur to blur

total=total + [result from xpos+x,ypos+y]

next
next

put total/(((blur*2)+1)*((blur*2)+1)) into a new image or array or whatever at xpos,ypos. This total divided by the total blur size squared, so if blur is 1 then it's a 3x3 block = 9. blur=2 will be a 5x5 block = 25

next
next

Then copy the new image or array you're using over the top of the old one. Hey presto blurry heaven!