Hi all,
A little function that can render a skysphere from any scene - uses the camera and point so it's real slow with high resolutions. Check out the example, there's code to display the results too.
The skybox is one of Clueless's.
I wanna see some 3D screenshots
- just remember it'll take ages to render, the one I've attached took about 3 hours
[1600 Athlon w. GF5200].
Code:
`Skygrabber, by Van-B
`This will render a skysphere at the camera location at any resolution - SLOW though
`rendersky("skysphere.bmp",1024)
load image "skysphere.bmp",6,1
`create_skysphere(objectno,texture,radius#)
create_skysphere(200,6,5000.0)
position object 200,camera position x(),camera position y(),camera position z()
do
rotate camera mousey(),mousex(),0
sync
loop
function create_skysphere(o,t,r#)
make object sphere o,r#/2.0
texture object o,t
set object light o, 0
set object texture o, 3, 0
set object fog o,0
set object cull o,0
set camera range 10,r#+50.0
endfunction
function rendersky(fn$,res)
file=2
if file exist(fn$)=1 then delete file fn$
img_res1=res/256
img_res2=res-(img_res1*256)
open to write file,fn$
write byte file,66
write byte file,77
write byte file,54
write byte file,48
write byte file,0
write byte file,0
write byte file,0
write byte file,0
write byte file,0
write byte file,0
write byte file,54
write byte file,0
write byte file,0
write byte file,0
write byte file,40
write byte file,0
write byte file,0
write byte file,0
write byte file,img_res2
write byte file,img_res1
write byte file,0
write byte file,0
write byte file,img_res2
write byte file,img_res1
write byte file,0
write byte file,0
write byte file,1
write byte file,0
write byte file,24
write byte file,0
write byte file,0
write byte file,0
write byte file,0
write byte file,0
write byte file,0
write byte file,48
write byte file,0
write byte file,0
write byte file,67
write byte file,12
write byte file,0
write byte file,0
write byte file,67
write byte file,12
write byte file,0
write byte file,0
write byte file,0
write byte file,0
write byte file,0
write byte file,0
write byte file,0
write byte file,0
write byte file,0
write byte file,0
`This will mess up your view
px=screen width()/2
py=screen height()/2
set camera fov 2
set camera view px-8,py-8,px+8,py+8
for dy=res-1 to 0 step -1
for dx=0 to res-1
ya#=(((dx*1.0)/(res*1.0))*360.0)
xa#=(((dy*1.0)/(res*1.0))*180.0)-90.0
rotate camera xa#,ya#,0
text 0,0,str$(int(dy/(res/100.0)))+"% Complete"
`You'll need this if your using terrain
`update terrain
sync
col=point(px,py)
r=rgbr(col)
g=rgbg(col)
b=rgbb(col)
write byte file,b
write byte file,g
write byte file,r
next dx
next dy
close file file
`This will need changing no doubt
set camera fov 30
set camera view 0,0,screen width(),screen height()
endfunction
It's c**p being the only coder in the village.