generating a game skybox with Celestia

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

Cigaboo
Topic author
Cigaboo
Topic author
Posts: 2
With us: 10 years 2 months

#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.

selden
Avatar
selden
Posts: 10010
With us: 14 years 10 months
Location: NY, USA

#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
chris
Site Admin
Posts: 4217
With us: 15 years 5 months
Location: Seattle, Washington, USA

Re: generating a game skybox with Celestia

#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

Cigaboo
Topic author
Cigaboo
Topic author
Posts: 2
With us: 10 years 2 months

#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?

t00fri
Avatar
t00fri
Age: 15
Posts: 8800
With us: 15 years 3 months
Location: Hamburg, Germany

#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

selden
Avatar
selden
Posts: 10010
With us: 14 years 10 months
Location: NY, USA

#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”

Who is online (over the past 5 minutes)

Users browsing this forum: 1 guest