generating a game skybox with Celestia

All about writing scripts for Celestia in Lua and the .cel system
Topic author
Cigaboo
Posts: 2
Joined: 24.05.2007
With us: 17 years 6 months

generating a game skybox with Celestia

Post #1by Cigaboo » 24.05.2007, 07:25

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.

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 2 months
Location: NY, USA

Post #2by selden » 24.05.2007, 09:32

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

chris
Site Admin
Posts: 4211
Joined: 28.01.2002
With us: 22 years 9 months
Location: Seattle, Washington, USA

Re: generating a game skybox with Celestia

Post #3by chris » 24.05.2007, 15:57

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

Topic author
Cigaboo
Posts: 2
Joined: 24.05.2007
With us: 17 years 6 months

Post #4by Cigaboo » 24.05.2007, 20:27

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?

Avatar
t00fri
Developer
Posts: 8772
Joined: 29.03.2002
Age: 22
With us: 22 years 7 months
Location: Hamburg, Germany

Post #5by t00fri » 24.05.2007, 20:44

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

Avatar
selden
Developer
Posts: 10192
Joined: 04.09.2002
With us: 22 years 2 months
Location: NY, USA

Post #6by selden » 24.05.2007, 21:17

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


Return to “Scripting”