Flat projection -> Sperical projection............HELP

Tips for creating and manipulating planet textures for Celestia.
Topic author
Thurlor
Posts: 25
Joined: 03.12.2005
With us: 18 years 11 months

Flat projection -> Sperical projection............HELP

Post #1by Thurlor » 05.12.2005, 14:05

Well, I'm currently trying to convert a planet map that I once hand drew to a planetary texture. The problem I'm having is that I created this map before I really knew anything about different map projections, and consequently it fails to take into accout the way in which the image becomes 'pinched' at both the top and the bottom. Now, I understand why all of this happens, but I have come to like the shape of some of my near polar landmasses and don't wish to see them change when wrapped around a sphere.
I'm wanting to know if there is some way in which I can apply my landmasses to a sphere (independently if needed) whilst keeping there original shape, then unwrap this image and have a hew flat image in which the landmasses are 'stretched' instead of 'pinched'?
I hope that makes sense.

Thanks for any help in advance.

GlobeMaker
Posts: 216
Joined: 30.10.2005
With us: 19 years

Post #2by GlobeMaker » 05.12.2005, 16:30

Yes, there are several ways to do that. Hand drawn pictures can use the same technique the great artists of the middle ages used : grid lines. Make copies of your favorite drawing, so you can draw new grid lines on it in pencil. The lines can be 15 degrees apart, like on a globe of the Earth.

You did not post an image of the drawing you made, so I will guess : the drawing is of a globe, with the north pole having accurately drawn land masses that you like. I hope the pole is at the center. Draw lines of longitude that radiate away from the pole, every 15 degrees. 360/15 = 24 so you will draw 24 lines that converge at the pole.

Draw lines of latitude every 15 degrees on the globe picture. There are 12 lines of latitude. Use light blue for all grid lines.When the whole globe is drawn with these lines, there will be 288 sectors with many shapes. The sectors at the poles will be triangles. This may be difficult to do accurately, since the planet you are designing is not drawn on a ball.

Next, a cylindrical projection will be created using those lines of latitude and longitude. Mark a piece of paper with a rectangular grid of 25 vertical lines and 13 horizontal lines. The horizontal lines are not spaced equally, but follow the tangent function. See the link below. This makes 288 rectangles. Hand draw, into each rectangle, the land shape seen on the globe view for the corresponding sector. Use black lines. The triangular sectors at the poles will become rectangles by stretching the land shapes by amounts proporational to the size of the parts of the rectangles to be filled.

By redrawing the 288 sectors, the distortion due to stretching becomes easier to handle with some accuracy. It is easier to handle each rectangle than it is to handle the whole picture at once. This new cylindrical projection can be scanned into a jpeg file, or any format. Use photoshop to make the grid disappear. The light blue can be made to disappear , while black stays.

This new texture should be in a cylindrical projection, and that is what Celestia needs.

Additional information on projections :
http://mathworld.wolfram.com/CylindricalProjection.html

I forgot to mention the tangent function is used to stretch the latitudes.
See the link.

But that transformation is from a sphere to a flat rectangle. I assume you are not starting from a sphere, but from a flat picture of a globe. Please show images of your starting point.

Or even better, get a ball and draw the continents on a ball. Then, accurate projections can be created.
Your wish is my command line.

Topic author
Thurlor
Posts: 25
Joined: 03.12.2005
With us: 18 years 11 months

Post #3by Thurlor » 06.12.2005, 00:47

Well, as for the map I am working on, here is a shrunk down version of it. The original was hand drawn and coloured, but since scanning, it needed some cleaning up, and I find it a hell of a lot easier to work with black and white images.

http://world-o-mine.atspace.com

Yes I am starting from a flat image and ultimately want to apply this to a globe, but want to keep the shapes of the original landmasses (as shown on my flat projection). As the islands appear on my flat projection is how I want them to appear on the sphere. Then I would need to create a new flat projection from this sphere.

Are there any programs that will do this for me? I know, I'm lazy :D

Oh, before anyone points out to me the extremely large scale of the planets features (1500km wide deltas & river systems {25,000km for one} that make Earths look like canals), I am already aware of this and I am currently working on an a plausible explanation for such a setup.

GlobeMaker
Posts: 216
Joined: 30.10.2005
With us: 19 years

Post #4by GlobeMaker » 06.12.2005, 01:44

Hi Thurlor,

I looked at your image of a planet's map. It is helpful that you have no details at either pole.

"I would need to create a new flat projection from this sphere. Are there any programs that will do this for me?"

No.

My recommendation is to use Celestia to wrap a flat map onto a simulated globe. This is the best software to help you. This will take about four passes :

Pass 1 : use your existing map and wrap in on a Celestia planet. Note what you do not like.

Pass 2 : Draw a new map that fixes what you did not like on pass 1. Use the new map as a texture for a Celestia planet. Note what you do not like.

Pass 3 : Draw a newer map that fixes what you did not like on pass 2. Use the newer map as a texture for a Celestia planet. Note what you do not like.

Pass 4 : Draw a final map that fixes what you did not like on pass 3. Use the final map as a texture for a Celestia planet. Show us what you do like.

This involves much less work than other methods. The Celestia software is an easy tool for you to transform your projections. Then you do not need to get a rubber ball and do the much harder work that past generations of map makers struggled with.
Your wish is my command line.

Topic author
Thurlor
Posts: 25
Joined: 03.12.2005
With us: 18 years 11 months

Post #5by Thurlor » 06.12.2005, 02:06

I've also figured that I could possibly use a 3D modelling prog to get something cobbled together. BTW I use Cinema 4D XL.

However, what I need is some way to calculate the amount of 'pinching' at a specific latitude than I need some way to pinch each of the northern landmasses and the southern seas (each can be done as transparent selections then pasted back into the original image).

For example I select a square around Island A. If I knew that the ratio of 'pinching' was 3/2 then the ration of 'stretching' would be 3/2. Thus my new transformed square would have a stretched top edge of 1.5 times the length of the original.

This should counteract the 'pinching' I think.

My only problem with this is I do not know how to go about stretching one face of an image.

GlobeMaker
Posts: 216
Joined: 30.10.2005
With us: 19 years

Post #6by GlobeMaker » 06.12.2005, 03:14

"I do not know how to go about stretching one face of an image.".

If you know how to program a computer you can continue :

The jpeg image of your map is not a good format to modify.
What you need is an x y array of pixels. It is called a raster or a
BITMAP.

Instead of the compressed jpeg format, use the simple .bmp
bitmap format. This link describes it.

http://www.fortunecity.com/skyscraper/w ... ffrmt.html

If you write a program that handles the .bmp format, you can stretch
or pinch each row mathematically. Are you educated in the trigonometric
functions?

If you are baffled by sines and arctangents, then learn them first,
then you will succeed. Those functions are needed to automatically
stretch and pinch the bitmap rows and columns with precision.
Rows in a .bmp array are latitudes. Columns are longitudes.

Are you ready for this?
Your wish is my command line.

Topic author
Thurlor
Posts: 25
Joined: 03.12.2005
With us: 18 years 11 months

Post #7by Thurlor » 06.12.2005, 04:34

Actually the original file from the scanner is a 4100x2050 52 Mb bitmap (after cropping). When I was back in high school (finish in '95) I was pretty darn good at all my maths, so I think I could easily refresh my memory. However my programming skills are very limited as I've never learnt anything but pascal and that was a good 10 years ago.

Anyways, I'm going to do a search for image manipulation progs that can do what I want.

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

Post #8by selden » 06.12.2005, 10:51

There are several programs that can do the appropriate remapping of images. Some are mentioned at http://www.lepp.cornell.edu/~seb/celest ... s.html#2.1

Don't forget that the result must be a power of two on a side: 2048x1024 for example.
Selden

GlobeMaker
Posts: 216
Joined: 30.10.2005
With us: 19 years

Post #9by GlobeMaker » 06.12.2005, 14:30

Hi Selden,

I read your linked page where you wrote, "Various programs are available for remapping (distorting) a flat image into a cylindrical projection. Some freeware utilities are a spherical texture mapping Photoshop plugin".

I have never seen a "flat image" of the whole Earth that did not use a projection that has a name. Please give an example. Is that a photo of a globe? Do you mean that we should use several photos of Earth taken from 24,000 miles away and merge them into a quiltwork, then use the freeware to fix up the quilted image?
Your wish is my command line.

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

Post #10by selden » 06.12.2005, 15:04

GlobeMaker wrote:Hi Selden,

I read your linked page where you wrote, "Various programs are available for remapping (distorting) a flat image into a cylindrical projection. Some freeware utilities are a spherical texture mapping Photoshop plugin".

I have never seen a "flat image" of the whole Earth that did not use a projection that has a name.
You're confusing me. Or else you didn't read the whole page. Celestia uses the projection "simple cylindrical." That is the name of a projection. That projection also is called "Plate Carree." It is the projection used for most NASA and USGS planetary surface maps, although you can get them in other projections, too.
Please give an example. Is that a photo of a globe? Do you mean that we should use several photos of Earth taken from 24,000 miles away and merge them into a quiltwork, then use the freeware to fix up the quilted image?


That's one of many things you can do.

You were asking about algorithms to stretch a picture so it would work properly with Celestia. Hopefully you know what type of projection you're starting with.

Both MMPS and Iris can translate from most projections into simple cylindrical. Iris also can be used to manipulate photographs of planets to generate simple cylindrical projections that can be merged into a full surface map. Its documentation includes an example for Jupiter, I think.

http://www.users.globalnet.co.uk/~arcus/mmps/mmps.html

http://astrosurf.com/buil/us/iris/iris.htm
Selden

GlobeMaker
Posts: 216
Joined: 30.10.2005
With us: 19 years

Post #11by GlobeMaker » 06.12.2005, 17:29

Hello Thurlor and Selden,

The imaginary planet that Thurlor has drawn is not drawn in any standard projection. I recommend drawing the continents, rivers, and deltas on a rubber ball. Then photograph the ball from a measured distance, taking notes on the central longitude and latitude for each photo. Then use the software Selden has shown us to convert those pictures to a cylindrical projection.

Thurlor will need to calculate the ratio of the distance from the camera to the ball divided by the radius of the ball.

Thank you Selden for the wonderful links related to textures in Celestia.
Your wish is my command line.

Topic author
Thurlor
Posts: 25
Joined: 03.12.2005
With us: 18 years 11 months

Post #12by Thurlor » 06.12.2005, 23:09

After reading all of this I think I might just give up trying to represent this map on a sphere. Or at the very least, I'm not going to try and use some weird program with diddly in the way of documentation. Actually, if anyone here can help me with the usage of Iris I would be very appreciative.
I have so far had some limited success by deforming the individual features then pasting them back to the original. I'll show my work when I think it is partially okay.

LoneHiker
Posts: 53
Joined: 10.10.2005
With us: 19 years 1 month

Post #13by LoneHiker » 24.12.2005, 03:17

Don't know if this will help, but if you have Photoshop or Paint Shop Pro you can try loading your texture, resizing the width to make the texture square, then run the polar coordinates distortion filter (rectangular to polar). Edit the area around the pole then run the opposite filter (polar to rectangular). Resize the width back to twice the height and save.

To do the south pole reload the original texture, flip it vertically, then repeat the above steps. (I don't know offhand if you need to flip it or rotate it 180?°.)

After both poles are edited composite them with the original texture. The results will be soft because of all the resampling, but at least you'll have guide for drawing.

You can download fully functioning demos of Photoshop and Paint Shop Pro from Adobe.com and Corel.com, respectively.

Lone

Topic author
Thurlor
Posts: 25
Joined: 03.12.2005
With us: 18 years 11 months

Post #14by Thurlor » 25.12.2005, 06:01

Well, after much searching on the net I finally came across a program that was able to do what I wanted.

http://www.ridgenet.net/~jslayton/ReprojectImage.zip

It took me a while but I figured out how to reproject each feature I wanted and then paste them back to the original. Some things just had to be sacrificed, but over all I'm damn happy with the results.


Return to “Textures”