Zoom In World
Blitz3D Forums/Blitz3D Programming/Zoom In World
| ||
Has anyone written a "Zoom In World" in Blitz3D. Like the one at the following website? http://mrl.nyu.edu/~perlin/planet/ It uses Perlin Noise to zoom in on a planet. Just hold down the left mouse botton on a spot and move the mouse left or right. I could see alot of uses for this type of code. It could be used to generate a height map for 3D terrain generation. Should be easy enough to do in Blitz3D. Here is some 2-dimensional Perlin Noise Pseudocode function Noise1(integer x, integer y) n = x + y * 57 n = (n<<13) ^ n; return ( 1.0 - ( (n * (n * n * 15731 + 789221) + 1376312589) & 7fffffff) / 1073741824.0); end function function SmoothNoise_1(float x, float y) corners = ( Noise(x-1, y-1)+Noise(x+1, y-1)+Noise(x-1, y+1)+Noise(x+1, y+1) ) / 16 sides = ( Noise(x-1, y) +Noise(x+1, y) +Noise(x, y-1) +Noise(x, y+1) ) / 8 center = Noise(x, y) / 4 return corners + sides + center end function function InterpolatedNoise_1(float x, float y) integer_X = int(x) fractional_X = x - integer_X integer_Y = int(y) fractional_Y = y - integer_Y v1 = SmoothedNoise1(integer_X, integer_Y) v2 = SmoothedNoise1(integer_X + 1, integer_Y) v3 = SmoothedNoise1(integer_X, integer_Y + 1) v4 = SmoothedNoise1(integer_X + 1, integer_Y + 1) i1 = Interpolate(v1 , v2 , fractional_X) i2 = Interpolate(v3 , v4 , fractional_X) return Interpolate(i1 , i2 , fractional_Y) end function function PerlinNoise_2D(float x, float y) total = 0 p = persistence n = Number_Of_Octaves - 1 loop i from 0 to n frequency = 2i amplitude = pi total = total + InterpolatedNoisei(x * frequency, y * frequency) * amplitude end of i loop return total end function |
| ||
Can anyone convert this Pseudocode to blitz3d commands? I am not good at C programming protocal. |
| ||
I've fiddled with perlin noise equations to create a texture for a planet... but wasn't happy with the results. The demo on that page is fantastic but pretty slow. |