Lat / Long Map Distortion

Tips for creating and manipulating planet textures for Celestia.
Topic author
galileo
Posts: 34
Joined: 14.12.2003
With us: 20 years 11 months

Lat / Long Map Distortion

Post #1by galileo » 30.03.2004, 21:14

Hi,

I'm looking for a software, preferably a gimp 2.0 or photoshop plugin that can take image maps such as the blue marble or the various 2:1 texture maps for planets, and "straighten" out the aspect so that the flat map is not stretched as latitude increases. My goal is to end up with an image where the tops have been folded in, rather than stretched out to fill the square.

More specifically I am looking for a program that can go in both directions (I have one photoshop plugin that only seems to know how to stretch a simple map out to fill a rectangle, but cannot go the other way).

Hope this makes sense. :)

Also, where can I find a link to t00fri's virtualtex script? I have some interesting projects on the horizon I might like to port to Celestia, and they will need to be VTs (as the maps are typically 16k+). A quick search in this forum yielded no results.

Mike

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

Post #2by selden » 30.03.2004, 21:28

Although it's not ideal (it seems to have some off-by-one problems) and it's not a plugin, Iris can be used to transform images between any of a large number of mapping projections. See http://astrosurf.com/buil/us/iris/iris.htm

The most recent version of Fridger's virtualtex routine is available at http://www.celestiaproject.net/~t00fri/virtualtex

Older versions are in the same directory.
Selden

maxim
Posts: 1036
Joined: 13.11.2003
With us: 21 years
Location: N?rnberg, Germany

Re: Lat / Long Map Distortion

Post #3by maxim » 30.03.2004, 23:16

galileo wrote:I have one photoshop plugin that only seems to know how to stretch a simple map out to fill a rectangle, but cannot go the other way

I am searching for something like that. If it`s a free plugin, would you mind making it available for me?

selden wrote:it seems to have some off-by-one problems


If you mean that it increases width and height by one pixel, I would suggest that you correct the computed degrees/pixel value by hand by some 1/100 or 1/1000. That solves that problem.

maxim

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

Post #4by selden » 30.03.2004, 23:25

Maxim,

It also offsets the center and/or edges so that it is not extracting exactly the correct area from the source. When working with Hammer projections, for example, it either trims off too much or not quite enough along part of one side. I tried many different combinations of scaling factors and offsets and cutting and pasting, but finally gave up. It seems to be about +/- one pixel, so the seam isn't too bad, but still...
Selden

maxim
Posts: 1036
Joined: 13.11.2003
With us: 21 years
Location: N?rnberg, Germany

Post #5by maxim » 31.03.2004, 00:17

I did mostly mollweide projections, and found that it is very sensitive to slight (shear) distortions of the original. It`s very easy to get bad results.

I also started with combinations first, but the input scale and the output scale are completely independent from each other. With output scale you can exactly set your results to power-of-two sizes. The input scale (sometimes) allows to correct slight distortions. But you have to run a lot of tests. Another trick that helps sometimes, is to extend the original by one or two dummy scanlines horizontally or vertically.

You can also try to generate a dummy by reverse project an empty pic and add a mapgrid - then use this as a shape for adjusting your original before projecting.

Probably you know all this already.

maxim

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

Post #6by selden » 31.03.2004, 00:36

Yup. Tried about 3/4 of the things you mention. I didn't try creating a grid, though. I just got tired of fighting with it.

I wrote a message to the author about the problem, but he never responded. I suspect it's an ancient problem he really isn't interested in fixing at this late date. :(
Selden

maxim
Posts: 1036
Joined: 13.11.2003
With us: 21 years
Location: N?rnberg, Germany

Post #7by maxim » 31.03.2004, 00:51

Well, I`m currently trying to get access to an arcview implementation. If I succeed anytime, we`ll see how it`s been handled there.

Wonder if it`s a difficult work to get some more projections included directly into Celestia. At least a lot of formulas are described here .

maxim

Redfish
Posts: 185
Joined: 22.05.2002
With us: 22 years 6 months
Location: Lat: 50.850 Long: 5.683 | Maastricht Netherlands
Contact:

Post #8by Redfish » 10.06.2004, 17:08

Could someone tell me where to find this option? I've been looking and reading help but can't find it unfortunately.

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

Post #9by selden » 10.06.2004, 20:39

Redfish,

If you mean the MAP option in IRIS, there is a single brief English Web page describing it at http://astrosurf.com/buil/us/iris/iris20.htm, but you need to read the four French Web pages starting at http://astrosurf.com/buil/iris/lecon19.htm for all of the details.

Briefly, here's the method that I used:

1) create an appropriate projection definition file (filetype .LST) corresponding to the actual projection of the input image

2) create an appropriate projection definition file (filetype .LST) corresponding to the desired projection of the output image

3) split the full-color image into three separate grey-scale images, one for each of the three color channels.
(I use BMP format for the three monochrome images)

4) Use the IRIS File menu to load the channel image to be remapped (I found that it must be a grey-scale image, not color -- there is a not-immediately-fatal memory allocation problem for the blue channel when reprojecting a color image.)

5) open the "command line window" (click on the icon in IRIS' row of icons that's yellow and contains several horizontal red lines. I think it's the 3rd or 4th counting from the *RIGHT* end of the row.)

6) In that popup window, type the command
MAP input-projection-filename output-projection-filename
(omitting the filetype .LST from both projection-filenames)

The image shown by IRIS will change shape.

7) save IRIS' image buffer to disk

8) Repeat steps 4, 6 and 7 for the other two color channels

9) merge the 3 output color channel files into a single color image.

I hope this helps.
Selden

Bob Hegwood
Posts: 1048
Joined: 19.10.2003
With us: 21 years 1 month
Location: Germantown, Ohio - USA

Post #10by Bob Hegwood » 11.06.2004, 05:17

selden wrote:The most recent version of Fridger's virtualtex routine is available at http://www.celestiaproject.net/~t00fri/virtualtex

Sorry to interject here, but is Dr. Schrempp's Virtualtex script compatible with
the latest versions of Cygwin, Image Magic, and NetPBM? Just curious. I managed
to screw up my Cygwin installation somehow, and when I re-installed it specifically
for use with the Virtualtex script, I kept getting strange errors after the script
reached the 83rd or 84th tile for an 8k VT for Mars.

Dr. Schrempp? Anything different I should know about now? By the way, this
little utility is *very* handy. I don't think I can go on living without it. :cry:

Take care, Bob
Bob Hegwood
Windows XP-SP2, 256Meg 1024x768 Resolution
Intel Celeron 1400 MHz CPU
Intel 82815 Graphics Controller
OpenGL Version: 1.1.2 - Build 4.13.01.3196
Celestia 1.4.0 Pre6 FT1

Bob Hegwood
Posts: 1048
Joined: 19.10.2003
With us: 21 years 1 month
Location: Germantown, Ohio - USA

Post #11by Bob Hegwood » 13.06.2004, 08:18

Never mind...

It only took me one *whole* day to figure out to get the latest versions of Cygwin,
Netpbm, ImageMagick and Virtualtex to cooperate again. Whew! :wink:

Thanks, Bob
Bob Hegwood

Windows XP-SP2, 256Meg 1024x768 Resolution

Intel Celeron 1400 MHz CPU

Intel 82815 Graphics Controller

OpenGL Version: 1.1.2 - Build 4.13.01.3196

Celestia 1.4.0 Pre6 FT1

Redfish
Posts: 185
Joined: 22.05.2002
With us: 22 years 6 months
Location: Lat: 50.850 Long: 5.683 | Maastricht Netherlands
Contact:

Post #12by Redfish » 13.06.2004, 13:42

selden wrote:Redfish,

If you mean the MAP option in IRIS, there is a single brief English Web page describing it at http://astrosurf.com/buil/us/iris/iris20.htm, but you need to read the four French Web pages starting at http://astrosurf.com/buil/iris/lecon19.htm for all of the details.

Briefly, here's the method that I used:

1) create an appropriate projection definition file (filetype .LST) corresponding to the actual projection of the input image

2) create an appropriate projection definition file (filetype .LST) corresponding to the desired projection of the output image

3) split the full-color image into three separate grey-scale images, one for each of the three color channels.
(I use BMP format for the three monochrome images)

4) Use the IRIS File menu to load the channel image to be remapped (I found that it must be a grey-scale image, not color -- there is a not-immediately-fatal memory allocation problem for the blue channel when reprojecting a color image.)

5) open the "command line window" (click on the icon in IRIS' row of icons that's yellow and contains several horizontal red lines. I think it's the 3rd or 4th counting from the *RIGHT* end of the row.)

6) In that popup window, type the command
MAP input-projection-filename output-projection-filename
(omitting the filetype .LST from both projection-filenames)

The image shown by IRIS will change shape.

7) save IRIS' image buffer to disk

8) Repeat steps 4, 6 and 7 for the other two color channels

9) merge the 3 output color channel files into a single color image.

I hope this helps.


Hmm I sound like a lot of work, but I'll give it a try.

However I did make a DDS file after I edited a tile. I then saved it as DDS, with some DXT compression. I did change the size of the tile though, but when I tried to view it in Celestia, it got a grey band over the earth sphere. Is is the tile resolution change? This would be really easy just scale it up and paste the higher res image over it. Or could it be the compression type I used?

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

Post #13by selden » 13.06.2004, 14:23

Redfish,

You're leaving out too much for me to guess what might have gone wrong.

"It works fine for me."

I converted a BlueMarble level10 dds dxt1 image (a Cape Canaveral tile made by Jens) to bmp (using Infranview);
used XP's paint program to scribble on it;
converted it back to dds dxt3 (imageMagick convert to tga, nvdxt to dxt3);
and the result looked OK when viewed in Celestia.

Here's the tile (in jpeg):
Image

and here's what it looks like in Celestia:
Image

What does the DDS tile that you created actually look like? Can you provide a link to it? (I've found that Infranview is a good viewer for DDS images.)

I think Celestia would have no problems when different kinds of DXT compression are used for different tiles within a level.

Are all the other tiles in that VT DDS?
If so, what kind of DXT compression do they use?
What kind of DXT compression did you use?
Exactly what commands did you use to create your tile?

What does the "grey band over the earth" actually look like? Can you provide a link to a screengrab?

(I can't tell if you mean that there's a grey band within your tile, or completely replaces your tile, or covers a larger portion of the Earth than your tile should.)
Selden

Redfish
Posts: 185
Joined: 22.05.2002
With us: 22 years 6 months
Location: Lat: 50.850 Long: 5.683 | Maastricht Netherlands
Contact:

Post #14by Redfish » 13.06.2004, 19:06

Hi Selden,

thank you for your response. I'm happy to tell you that I've got the file working in Celestia. I think it might have had something to do with the fact that I incorrectly used 8096 instead of 8192 pixels for the width and heigth.

I uploaded a tile pack so you can see the result. You will also see that when you zoom in there is a shift in the middle of the map although the left side of the image and top right parts are positioned correctly on the map. I really am confused. I haven't been using iris, but been trying to position the image with photoshop following kinderino's advice. He told me he just skewed the image a bit around. I've tried a lot of times, but thought eventually that it was best to start out with the bottom, make sure the scale is correctly horizontally, then adjust the left and right top sides.

I came up with this idea because on the maps there is also an edited version for Switserland + Italy. The image that is placed over it has exactly straight lines at the bottom and top, but from bottom to top it's tapered. But unfortunatly this didn't really work for me. You can also see it when zooming in. It's also slightly rotated. With all the variabeles it's really hard to get positioning right...

Here's the link:

http://members.lycos.nl/REDFISH/Celestia

the file is called templevel5.zip
I have to do it this way, or else you'll get an external referer.

Oh: the map is for the Netherlands, Belgium and Luxembourg, which is east of England but I think you'll know where to find it.

(I can't tell if you mean that there's a grey band within your tile, or completely replaces your tile, or covers a larger portion of the Earth than your tile should.)


yes this assumption is correct. A larger than the tile itself grey patch replaced the tile on the globe.


Return to “Textures”