Sky

Blitz3D Forums/Blitz3D Beginners Area/Sky

Mr. Bean(Posted 2006) [#1]
How can I make a nice sky (day/night)
Please help me
(I'm 12-)


_PJ_(Posted 2006) [#2]
A simple way is to create a SkySphere.

The Skysphere will be a ball around your camera with a nice texture painted on the INSIDE. Then some code to ensure the SKYSPHERE is always drawn behind everything else to make it seem like the sky is naturally further away.

This achieved by the following:

skybox=CreateSphere(50) ; creates a smooth looking ball
ScaleEntity skybox,1.9,1.9,1.9 ; makes the ball just large enough fit around the camera
FlipMesh skybox ; Ensures the sky texture is painted to the INSIDE of the ball.
skytexture=LoadTexture("SkyTexture.bmp",777) 
EntityTexture skybox,skytexture
FreeTexture skytexture
EntityFX skybox,1 ;stops any local lighting factors affecting the sky
EntityParent skybox,cam
EntityOrder skybox,999 ; always draw the Sky first



---EDIT---

Remeber in your main loop, you will need to add:
RotateEntity skybox,0,0,0,1

This will stop the Sky turning with the camera.

If you wanted more specifically to change between daytime/nighttime, that's a little more detailed. There was some code elsewhere in this forum, Il try and find it if necessary.

---------------------------------

Edit (Again) A mmore complicated aproach, but for better results is a SKYBOX, which uses a cube around the camera: the tutorial for using Terragen (which can be downloaded free is very useful)

http://www.blitzbasic.com/Community/posts.php?topic=56962


Mr. Bean(Posted 2006) [#3]
Thanks.
How can I get the Skytexture?


Paul Murray(Posted 2006) [#4]
skytexture=LoadTexture("SkyTexture.bmp",777) 
EntityTexture skybox,skytexture



Mr. Bean(Posted 2006) [#5]
I mean the 'SkyTexture.bmp' File


_PJ_(Posted 2006) [#6]
Well, you can draw one, create one in blitz code, "steal" one off the internet (tsk tsk), use Terragen or somethig to render one or you can use this (my artistic skills leave a lot to be desired hehe):

(Remember to change it to a .bmp file or change the code to ("SkyTexture.jpg",777)





Mr. Bean(Posted 2006) [#7]
Thanks. It's a nice Texture


Paul Murray(Posted 2006) [#8]
http://blitzstuff.awardspace.biz/phpBB2/viewtopic.php?p=48#48

Tutorial on creating a skybox with Terragen


jfk EO-11110(Posted 2006) [#9]
777? that's 1 + 8 + 256 + 512 that's a lot of texture flags. Using 256 may be a way to prevent bluring trough mipmapping, tho it will also slow rendering down. It may or may not be a good idea to try other flags, or no flags at all (omit the 2nd parmater in the LoadTexture command).


_PJ_(Posted 2006) [#10]
Yeah I ripped the code straight from a graphic demo thing I had written, so I was using some high-detail stuff. Its not necessary to have the second parameter as jfk states :)

(thanks for noticing)


scribbla(Posted 2006) [#11]
are these of any use to you

http://blitzbasic.com/Community/posts.php?topic=57382


Mr. Bean(Posted 2006) [#12]
Oh, yes!!!!!!!!!!!!!!
Very much!!!!!!!!!!!!