generating a game skybox with Celestia

All about writing scripts for Celestia in Lua and the .cel system

Moderator: selden

generating a game skybox with Celestia

Postby Cigaboo » Thu May 24, 2007 12:25 am

Hi. In computer games, "skyboxes" are basically inverted textured cubes that give the illusion of being the backdrop landscape/sky for the game world. When the player moves, the skybox moves with him, giving the illusion that the player never reaches the cube.

Celestia seems like an ideal program to generate a realistic star skybox for the game I am creating. I think that I need to set the FOV to 90, which is easily accomplished by:

set { name "FOV" value 90.0 }

But I am a bit confused by the scripting for movement/rotating the camera.

I need to set the camera by the sun or another location in space. Then I need to precisely rotate the camera 90 degrees in different directions. I can then manually take screenshots. These screenshots will become the 6 textured sides of the cube. Executing the following code seems to keep changing the position of the camera each time it is executing (with the simulation paused), but I'm not sure I understand why:

#goto { [0.0 0.0 0.0] }

setposition {
base [ 0.0 0.0 0.0 ]
offset [ 0.0 0.0 0.0 ] }

setorientation {
angle 0.00
axis [ 0.00 0.0 0.0 ] }

Does anybody have any suggestions? Like I said, I just need to know how to set the camera at a certain coordinate, and then rotate the camera from that reference point precisely in 90 degree increments.
Cigaboo
 
Posts: 2
Joined: Thu May 24, 2007 12:11 am

Postby selden » Thu May 24, 2007 2:32 am

The axis values must not all be set to zero.

One description of the Axis,Angle orientation specification is at
http://www.euclideanspace.com/maths/geo ... /index.htm
Selden
User avatar
selden
 
Posts: 9902
Joined: Tue Sep 03, 2002 7:21 pm
Location: NY, USA

Re: generating a game skybox with Celestia

Postby chris » Thu May 24, 2007 8:57 am

Cigaboo wrote:Hi. In computer games, "skyboxes" are basically inverted textured cubes that give the illusion of being the backdrop landscape/sky for the game world. When the player moves, the skybox moves with him, giving the illusion that the player never reaches the cube.

Celestia seems like an ideal program to generate a realistic star skybox for the game I am creating. I think that I need to set the FOV to 90, which is easily accomplished by:

set { name "FOV" value 90.0 }

But I am a bit confused by the scripting for movement/rotating the camera.

I need to set the camera by the sun or another location in space. Then I need to precisely rotate the camera 90 degrees in different directions. I can then manually take screenshots. These screenshots will become the 6 textured sides of the cube. Executing the following code seems to keep changing the position of the camera each time it is executing (with the simulation paused), but I'm not sure I understand why:

#goto { [0.0 0.0 0.0] }

setposition {
base [ 0.0 0.0 0.0 ]
offset [ 0.0 0.0 0.0 ] }

setorientation {
angle 0.00
axis [ 0.00 0.0 0.0 ] }

Does anybody have any suggestions? Like I said, I just need to know how to set the camera at a certain coordinate, and then rotate the camera from that reference point precisely in 90 degree increments.


You probably want the following:

Code: Select all
setorientation { angle   0    axis  [ 0 1 0 ] }
setorientation { angle  90   axis  [ 0 1 0 ] }
setorientation { angle 180    axis  [ 0 1 0 ] }
setorientation { angle -90    axis  [ 0 1 0 ] }
setorientation { angle  90    axis  [ 1 0 0 ] }
setorientation { angle -90    axis  [ 1 0 0 ] }


You'll still have to do some combination of rotating and flipping the screenshots in your image editing program.

--Chris
User avatar
chris
Site Admin
 
Posts: 4218
Joined: Mon Jan 28, 2002 12:21 pm
Location: Seattle, Washington, USA

Postby Cigaboo » Thu May 24, 2007 1:27 pm

Thanks, guys. Much appreciated. If I am successful, should be much cooler than some randomly generated starfield. BTW, are Celestia's star color values somewhat exaggerated? I will probably want to desaturate the colors a bit in Photoshop. And is Celestia's representation of the Milky Way galaxy (the cloudy greyish band) an accurate depiction of what you would see with the unaided eye from space, or should I disable it from within Celestia?
Cigaboo
 
Posts: 2
Joined: Thu May 24, 2007 12:11 am

Postby t00fri » Thu May 24, 2007 1:44 pm

Cigaboo wrote:Thanks, guys. Much appreciated. If I am successful, should be much cooler than some randomly generated starfield. BTW, are Celestia's star color values somewhat exaggerated? I will probably want to desaturate the colors a bit in Photoshop. And is Celestia's representation of the Milky Way galaxy (the cloudy greyish band) an accurate depiction of what you would see with the unaided eye from space, or should I disable it from within Celestia?


DISABLE...

The more you disable from Celestia for your game, the happier I am ;-)

Bye Fridger
Image
User avatar
t00fri
 
Posts: 8787
Joined: Fri Mar 29, 2002 5:53 am
Location: Hamburg, Germany

Postby selden » Thu May 24, 2007 2:17 pm

You can cause Celestia to represent stars in several different ways. e.g. type ctrl-S and/or % several times to see some of the variations.
Selden
User avatar
selden
 
Posts: 9902
Joined: Tue Sep 03, 2002 7:21 pm
Location: NY, USA


Return to Scripting

Who is online

Users browsing this forum: No registered users and 3 guests