This method of planet generation uses faulting. It cuts a slice through the sphere and increases the or decreases the height one side of the slice. Make enough slices (or faults) and you get a realistic looking planet once to colour it by height.
#constant count 300
dim h(255,255)
q=reset_land()
sync on:sync rate 0
backdrop on
color backdrop 0
cls
randomize timer()
for a=1 to count
q=fault()
next a
q=make_texture(1)
make object sphere 1,10
texture object 1,1
position object 1,0,0,0
position camera 0,0,-20
point camera 0,0,0
do
for r=1 to 360
yrotate object 1,r
sync
if inkey$()=" "
q=reset_land()
for a=1 to count
q=fault()
next a
q=make_texture(1)
texture object 1,1
endif
next r
loop
end
function fault()
rem raise or lower a portion of the planets surface
o=rnd(360)
m=20+(rnd(60))
m2=m*2
yoo=m+rnd(255-m2)
i=1
w#=(360.0/255.0)
if rnd(20)>10 then i=-1
for x=0 to 255
sv=o+(x*w#)
sv=wrapvalue(sv)
p#=(sin(sv)*m)
yo=yoo+p#
for y=yo to 255
inc h(x,y),i
next y
next x
endfunction i
function reset_land()
for x=0 to 255
for y=0 to 255
h(x,y)=0
next x
next y
endfunction 0
function make_texture(txr)
minh=9999
maxh=-9999
create bitmap 1,255,255
set current bitmap 1
cls
for x=0 to 255
for y=0 to 255
if h(x,y)>maxh then maxh=h(x,y)
if h(x,y)=water and th=grass
r=110:g=110:b=110
m#=th-grass
m#=1+(m#/range)
r=r*m#
g=g*m#
b=b*m#
endif
ink rgb(r,g,b),0
dot x,y
next x
next y
get image txr,0,0,255,255
delete bitmap 1
set current bitmap 0
endfunction 0