Cube or spherical map "screenshots"?

The place to discuss creating, porting and modifying Celestia's source code.
Topic author
posfan12
Posts: 24
Joined: 01.07.2010
With us: 14 years 4 months

Cube or spherical map "screenshots"?

Post #1by posfan12 » 06.07.2010, 06:13

Is it possible to take a "screenshot" that is an 2x1 aspect ratio sphere map? Or a cube map composed of six tiled images?

Is it feasible to manually set the FOV and camera positions such that taking multiple normal screenshots would result in equivalent images as a cube map? A script maybe?

Thanks!

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

Re: Cube or spherical map "screenshots"?

Post #2by selden » 06.07.2010, 10:46

A CELX script which generates simultaneous views in the 6 perpendicular viewpoint directions is described in the thread viewtopic.php?f=9&t=11218
In principle, it could be modified to do what you want.
Selden

Topic author
posfan12
Posts: 24
Joined: 01.07.2010
With us: 14 years 4 months

Re: Cube or spherical map "screenshots"?

Post #3by posfan12 » 06.07.2010, 19:54

I got the camera rotations to work using the script you linked to as an example.

However, is the FOV setting with respect to the horizontal or vertical screen dimension? Is there a way to limit what is drawn to only what lies within the FOV, and make the rest of the screen blank?

[edit]
OK, it seems that the FOV determines the vertical area (or whichever of the two is less), which is good for my purposes. I suppose I could just crop the image in an image editor, so I don't necessarily need the remainder of the screen to be blank.

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

Re: Cube or spherical map "screenshots"?

Post #4by selden » 06.07.2010, 20:06

The fov is relative to the height of the window. You can see this by opening a Celestia window and dragging its borders. Dragging the top or bottom changes the fov, but dragging either side does not.

Celestia always draws everything visible within its window. You'd have to have an object blocking the region you don't want to see.

The getscreendimension function returns the x and y dimensions of the window.
http://en.wikibooks.org/wiki/Celestia/C ... ndimension
but there doesn't seem to be any equivalent "set" function.
Selden

Topic author
posfan12
Posts: 24
Joined: 01.07.2010
With us: 14 years 4 months

Re: Cube or spherical map "screenshots"?

Post #5by posfan12 » 06.07.2010, 20:58

Here's the script:

Code: Select all

local obs = celestia:getobserver()
local image_count = 1;
obs:setframe(celestia:newframe("universal"))
obs:setfov(math.rad(90))

axis_vector = celestia:newvector(0,1,0)
rot = celestia:newrotation(axis_vector, math.rad(90))
for i = 1, 4 do
   wait(1.0)
   celestia:takescreenshot("png", image_count)
   obs:rotate(rot)
   image_count = image_count + 1
end

axis_vector = celestia:newvector(1,0,0)
rot = celestia:newrotation(axis_vector, math.rad(90))
for i = 1, 4 do
   wait(1.0)
   celestia:takescreenshot("png", image_count)
   obs:rotate(rot)
   image_count = image_count + 1
end


1. The script automatically takes 8 screenshots, 6 of which are needed and 2 of which are discarded since a cube has only 6 faces. Images #1 and #7 are duplicates and thus not needed. Delete them.
2. The next step is to open each image in XnView/GIMP/whatever and adjust the canvas size, lowering the image width so that the image width and height are equal, and discarding the remainder of the image.
3. I also had to rotate image #6 to the left by 90 degrees, and image #8 to the right by 90 degrees.
4. Once this is done, the orientation of the images is as follows (though this might vary depending on the application):
2 = front
3 = right
4 = back
5 = left
6 = bottom
8 = top

The only drawback as far as I can tell is that my computer monitor has a low vertical resolution of 786px, and I couldn't figure out how to go beyond that in Celestia.

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

Re: Cube or spherical map "screenshots"?

Post #6by selden » 06.07.2010, 21:33

Looks good!

Unfortunately, Celestia is (currently) limited to creating graphics images with the same resolution as the screen that it's using. My understanding is that most 3D realtime graphics controllers can actually draw into "virtual" windows which are larger than the screen, but Celestia can't do that (yet?).
Selden

VikingTechJPL
Posts: 105
Joined: 04.03.2010
With us: 14 years 8 months

Re: Cube or spherical map "screenshots"?

Post #7by VikingTechJPL » 06.07.2010, 22:28

posfan12,

Just a quick clarification:

Selden wrote:
The fov is relative to the height of the window.

This is true when Celestia's window contains only a single view.

For multiple views, which do not necessarily have to have the same fov, fov is measured relative to each view. You can see this by splitting a few views horizontally, altering their vertical dimensions, and then scrolling through them by pressing the Tab key.

This actually gives you a fair amount of flexibility, and you may want to try different proportions for the views that create the poles, etc.

Good luck creating your maps.

EDIT:
PS I see you're new to the Forum. Welcome!
1.6.1, Dell Studio XPS, AMD 2.7 GHz, 8 GB RAM, Win 7 64-bit, ATI Radeon HD 5670
1.6.0, Dell Inspiron 1720, Intel Core Duo 2 Ghz, 3 GB RAM, Win Vista, NVIDIA GeForce 8600M G/GT
1.4.1, Dell Dimension 4700, Pent-4 2.8 GHz, 512 MB RAM, Win XP SP2, Radeon X300

Topic author
posfan12
Posts: 24
Joined: 01.07.2010
With us: 14 years 4 months

Re: Cube or spherical map "screenshots"?

Post #8by posfan12 » 06.07.2010, 23:18

selden wrote:Looks good!

Unfortunately, Celestia is (currently) limited to creating graphics images with the same resolution as the screen that it's using. My understanding is that most 3D realtime graphics controllers can actually draw into "virtual" windows which are larger than the screen, but Celestia can't do that (yet?).
Well, I suppose I could use the mouse to expand the window, drag it to beyond the top left edge of the desktop, expand again, drag again, etc., etc. until the window is really huge, but the dimensions would not be precise.

VikingTechJPL
Posts: 105
Joined: 04.03.2010
With us: 14 years 8 months

Re: Cube or spherical map "screenshots"?

Post #9by VikingTechJPL » 07.07.2010, 04:19

posfan12 wrote:
Well, I suppose I could use the mouse to expand the window, drag it to beyond the top left edge of the desktop, expand again, drag again, etc., etc. until the window is really huge, but the dimensions would not be precise.

For your cube views you can use the entire window for each and can get the accuracy you need as follows:

1) You can move an exact distance over an exact Lat-Long of a body using "Navigation:Goto Object..." in CELESTIA's main menu.

2) You can use this two-line script to set your FOV to any Degrees you wish. Just change the number after
Degrees =
and then save and run the script.

Code: Select all

Degrees = 50
celestia:getobserver( ):setfov( math.rad ( Degrees ) )

For example, the code above sets FOV to 50 degrees.

The seams of your views may present the biggest problem. For more uniform lighting of your captured views, you can try viewing an object at fractional rotations, so all are lit essentially the same. For example, to get four directional views of Earth try them six hours apart. To do Earth's poles, you may want to try them at the Summer Solstice (for North Pole), and Winter Solstice (for South Pole) when each is lit to its maximum.

You might also try changing Ambient Light by pressing the { and } keys.

Good luck.
1.6.1, Dell Studio XPS, AMD 2.7 GHz, 8 GB RAM, Win 7 64-bit, ATI Radeon HD 5670
1.6.0, Dell Inspiron 1720, Intel Core Duo 2 Ghz, 3 GB RAM, Win Vista, NVIDIA GeForce 8600M G/GT
1.4.1, Dell Dimension 4700, Pent-4 2.8 GHz, 512 MB RAM, Win XP SP2, Radeon X300

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

Re: Cube or spherical map "screenshots"?

Post #10by selden » 07.07.2010, 11:36

posfan12 wrote:Well, I suppose I could use the mouse to expand the window, drag it to beyond the top left edge of the desktop, expand again, drag again, etc., etc. until the window is really huge, but the dimensions would not be precise.

A looping call to getscreendimension followed by print would show you the window's exact dimensions while you're dragging the edges.

Precise dimensions (although perhaps not the ones you want) can be obtained by selecting "full screen mode", in which case Celestia's window fills the entire screen with no borders.

There are (at least) three or four ways to run Celestia in full screen mode:

1A. Select the menu Render --> Select Display Mode... to specify resolutions less than or equal to the highest resolution supported by your display

1B. Select the menu Render --> Full Screen Mode (it uses the resolution most recently selected by method 1A)

2. Add the command line qualifier
--fullscreen
when starting Celestia from a command window or from a desktop shortcut (it uses the resolution most recently selected by method 1A)

3. I was sure there was a CelX method to do it, but one doesn't seem to be listed.
Selden

Topic author
posfan12
Posts: 24
Joined: 01.07.2010
With us: 14 years 4 months

Re: Cube or spherical map "screenshots"?

Post #11by posfan12 » 07.07.2010, 19:31

selden wrote:Precise dimensions (although perhaps not the ones you want) can be obtained by selecting "full screen mode", in which case Celestia's window fills the entire screen with no borders.
Yes, but as I said my monitor at fullscreen is not particularly big. Its native resolution is only 1366x768px.

Topic author
posfan12
Posts: 24
Joined: 01.07.2010
With us: 14 years 4 months

Re: Cube or spherical map "screenshots"?

Post #12by posfan12 » 23.01.2011, 01:28

Here you can see example output.


Return to “Development”