Cylindrical Projection Textures from "Space photographs

General discussion about Celestia that doesn't fit into other forums.
Avatar
Topic author
t00fri
Posts: 8814
Joined: 29.03.2002
Age: 16
With us: 16 years 1 month
Location: Hamburg, Germany

Post #21by t00fri » 13.07.2004, 10:01

Redfish wrote:
Fridger wrote:Let me compile mmps with Cygwin. It's hard for me to imagine that this is not a trivial task...I get back to you soon.
It was absolutely trivial to compile:
after downloading and extracting,
cd mmps
make

Well for me it wasn't trivial to compile. could you send them to me? I've installed cygwin, but when i start it i do'nt even know in what directory I am.

I find it really frustrating that I have to take 20 steps before I can accomplish something. For a typical windows user, this isn't very obvious, and is very tedious. So if compiling is so easy, why not just put up the windows version somewhere, that will save the windows users messing with the exotic archive formats, messing with cygwin etc etc.

Oh yes, finally I have it, but I doubt it anyone without linux experience would never have guessed that they first have to put the mmps dir in the cygwin directory, then type cd /
cd mmps
make

And considering i get X server errors when testing, it was compiled succesfully i guess.


Redfish,

sorry, but I am not ready to support that general attitude.

There is a very good manual/tutorial with detailed instructions on how to compile programs with gcc, about the Cygwin directory structure etc. If people do not want to read and learn, then they will for sure get stuck at the next station of VT-making as well...

"Convincing" people to learn how to install and use a great and most useful environment like Cygwin also prevents a host of upcoming (superfluous) questions by those who are just willing to click and don't learn along their way!

Somebody again needs to spend his time to answer all these questions, only because the people concerned don't want to spend theirs in learning...

Many many Windows users are meanwhile using Cygwin and have managed very well. The available documentation is excellent.

I do not see why you are getting X server errors at all!? You do not need an X-server for what you have to do. Just start a 'zsh' or 'bash'
and compile your program.

Last not least: command-line compiling with the commercial MS compiler is quite similar to that in Linux. One uses 'nmake' instead of 'make' in Linux. There is also a 'Makefile' with a related syntax, etc.

So I disagree with your claim that Cygwin compilation is entirely Linux specific and intrinsically "incomprehensible" to Windows users.

Numerous Windows users in this Forum meanwhile compile themselves, including even Celestia.

Bye Fridger
Last edited by t00fri on 13.07.2004, 11:29, edited 2 times in total.

Avatar
Topic author
t00fri
Posts: 8814
Joined: 29.03.2002
Age: 16
With us: 16 years 1 month
Location: Hamburg, Germany

Post #22by t00fri » 13.07.2004, 10:44

Toti wrote:
Fridger wrote:That I am not sure whether I understood. Aren't you simply saying that you want to convert the artificial color map into a level gray map? That again would be easy and I can do it with Gimp.
It's very simple, but (as I am sure you know) it's not mode->grayscale. You need to do a (linear) ramp conversion so Blue->Black=Lowest elevation and Red->White=Highest elevation.


Sure Toti,

that's what I meant. All required ramp conversion tools are available in Gimp. Actually Gimp2 is meanwhile the "standard" GIMP. It is very stable and has considerably more to offer than Gimp1. Also for people who dislike to work with many different small windows
there is now a "desktop" like option.

Bye Fridger

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

Post #23by Redfish » 13.07.2004, 18:43

Hi t00fri,

I did manage to compile the project program. However I still think that getting to this .exe for windows was more work than needed. Therefor I uploaded it to a server for people to download. I just wanted a working exe file. Not having to download 3 sorts of programs, soms exotic archive file and then find out where I was after running the cygwin shell so eventually I could find the directory with the source I had to compile.
I didn't want to learn cygwin. I just want to create textures. So in this case in my experience it is a waste of time to go and find out HOW and with WHAT I could compile this source code. So as to save this time for other people the compiled project.exe file is available at:

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

The problem I keep having with the project program is that whenever I use the | display, it want's to use the X- server, which I obviously don't have. Also it's not clear to me if this project thing can be used to edit the maps or does it just project them on a virtual sphere in the x environment.

I know they say that if you don't like reading you shouldn't try linux. I know for myself that I'm someone who likes to try and learn from that, instead of reading and then trying. You don't like to support my attitude, but I on the other hand I don't like the attitude that people should just try and try and learn while all they wanted is something very simple. I know you have a point that when nobody makes any effort in learning they will keep bothering you and other people who do know with silly questions, but my experience is just that in the linux community things need to be 20 steps for some weird reason when they also could be done in 2 steps or maybe even 1.

Avatar
Topic author
t00fri
Posts: 8814
Joined: 29.03.2002
Age: 16
With us: 16 years 1 month
Location: Hamburg, Germany

Post #24by t00fri » 13.07.2004, 19:30

Redfish wrote:Hi t00fri,

I did manage to compile the project program. However I still think that getting to this .exe for windows was more work than needed. Therefor I uploaded it to a server for people to download. I just wanted a working exe file. Not having to download 3 sorts of programs, soms exotic archive file and then find out where I was after running the cygwin shell so eventually I could find the directory with the source I had to compile.
I didn't want to learn cygwin. I just want to create textures. So in this case in my experience it is a waste of time to go and find out HOW and with WHAT I could compile this source code.


Fine, that is up to you. Different people have different aims.

The attitude that I tried to convey above has e.g. led in my case to the fact that I can do a lot of things fast, without using up other people's time for it...

I know quite a few in this Forum (and lots elsewhere) who have my full respect for sharing a similar view about continuous learning and trying to understand...

It is only tedious at the beginning...

So let's just wait until you hit the next problem in your VT project;-)

Bye Fridger

Avatar
Topic author
t00fri
Posts: 8814
Joined: 29.03.2002
Age: 16
With us: 16 years 1 month
Location: Hamburg, Germany

Post #25by t00fri » 13.07.2004, 21:50

Hi all,

as promised, I compiled Matthew Arcus' mmps package under Cygwin on my XP laptop. After typing 'make', it was a matter of a few seconds and everything was compiled, linked and ready to work.

I made a number of tests with the result, including the one displayed on Matthews new Webpage (Europa). Everything works as it should: Just fine.

The whole affair, including various tests did not take more than 3 minutes perhaps...

Bye Fridger

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

Post #26by Redfish » 13.07.2004, 22:15

Hi t00fri,

BTW, do you even use the project program to create higher resolution tiles from nasa images or any other sources. It would be really stupid if I spend my time and find out it's not suited for editing new tiles...

Avatar
Topic author
t00fri
Posts: 8814
Joined: 29.03.2002
Age: 16
With us: 16 years 1 month
Location: Hamburg, Germany

Post #27by t00fri » 13.07.2004, 23:10

Redfish wrote:Hi t00fri,

BTW, do you even use the project program to create higher resolution tiles from nasa images or any other sources. It would be really stupid if I spend my time and find out it's not suited for editing new tiles...


Redfish,

that never was my intent. The main scope of the (inverse) project program is to be able to quickly convert exciting new photographs from on-going space missions into cylindrical textures. The latter then can be read into and displayed in Celestia...

Another possible application would indeed be to locally patch existing textures with high resolution regions extracted with project -i from current photographs.

Bye Fridger

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

Post #28by Redfish » 14.07.2004, 00:07

t00fri,

I don't know if you tried to make larger area tiles before, but if you did, i'd like to hear which command you used exactly, if you don't mind telling me :) especially which mapping mode? Must be perspective then I guess...

Avatar
John Van Vliet
Posts: 2705
Joined: 28.08.2002
With us: 15 years 8 months

re

Post #29by John Van Vliet » 14.07.2004, 06:39

hi redfish at the very begining of this thred i posted a link to an allready compiled
( cygwin,g++ build) of mmps
called mmps.zip
http://johnscelestiapage.no-ip.com/filemgmt/visit.php?lid=63

Toti
Posts: 338
Joined: 10.02.2004
With us: 14 years 3 months

Post #30by Toti » 15.07.2004, 03:49

Fridger wrote:I made a number of tests with the result, including the one displayed on Matthews new Webpage (Europa). Everything works as it should: Just fine.
I compiled the sources without a single error message. I followed the instructions to the letter, yet my Europa's cylindrical map is crossed by colour bands.

Fridger wrote:Actually Gimp2 is meanwhile the "standard" GIMP. It is very stable and has considerably more to offer than Gimp1. Also for people who dislike to work with many different small windows

In WinMe it's quite unusable due to its unstability, so I usually do all image manipulations with Gimp 1.2.

I converted this shaded altitude map http://www.solarviews.com/raw/jup/amalthe4.jpg into a suitable displacement map. I applied a couple of Gimp filters to eliminate the shades without touching the height info.
Then, I used this texture to automatically build a new, high resolution 3D model of Amalthea.

Anyway, here are the steps to displace the sphere. I have included a little script that (I hope) will properly scale the altitude range and then fold the plane into a sphere. There are two constants that can be adjusted to match Phoebe's relief parameters, if someone manages to gather the data.
The goal is to maximize the accuracy of the object's 3D representation, given the resolution of the data available.
You must save it as anyname.py in the Blender\Scripts folder.

1] Start Blender
2] Put the mouse pointer over the dark gray main window. Hit NumPad 7
3] Hit Del to erase default cube mesh. When confirmation request appears, hit Enter.
4] Hit Space. In the panel that appears, go to add->mesh->plane. Hit Enter.
5] Hit w, select Subdivide. Hit Enter. Repeat 5-6 times.
6] Hit f5. At the bottom of the window, hit the AddNew button. Four panels appear. Go to the Texture-labelled one. Hit AddNew button. Click on the little mark where it says Tex.
7] Hit f6. Press the Up/down arrowed button. Go to where it says None. Select Image. Two panels appear. In the Image-labelled one press the LoadImage button. Select and open the displacement map.
8] Hit f9. Four panels appear. In the MeshTools-labelled one press the Noise button once. The mesh is now displaced.

9] Put your pointer over the main window and press Tab. Now the mesh should be pink.
10] Put your mouse pointer in the limit between the top menu bar and the main window. The pointer should be converted into a vertical double arrow. Drag. A new window appears. Hit the FilePaths button.
11] Several folder-input boxes appear. Go to the Phyton-labelled one, and press the small squared button, with a sheet in it.
12] Go to the main menu: file->import-ZFold. The plane should have been folded into a sphere.
13] Put the pointer over the main window. Hit Tab. The mesh should be yellow again.
14] Go to the MeshTools-labelled panel near the bottom of the screen. Push the RemDoubles button to remove the seam.

You can rotate the model dragging the mouse with Alt-LeftMouseButton pressed. For a shaded representation, hit z. For a smooth representation, press the SetSmooth button in the LinksandMaterials panel.

Code: Select all

#!BPY

"""
Name: 'ZFold'
Blender: 233
Group: 'Import'
Tooltip: 'Adjust Z length and folds a plane'
"""

#--------------------------------------------------
# By Toti

#--------------------------------------------------
# Change these constants accordingly to your data, BUT ADD A DECIMAL PART:

SATMAXRADIUS   = 110.0      #in km. from Celestia
DELTAHEIGHT      = 16.0      #in km, from Galileo's site (NASA)

#--------------------------------------------------
# Do not change these constants:

MAXN   = -1000000000000
MINN   = 1000000000000

#--------------------------------------------------
# Here starts the code:

import Blender
import math
from Blender import NMesh, Object

satMinRadius   = SATMAXRADIUS-DELTAHEIGHT

obj         = Object.GetSelected()
meshName      = obj[0].data.name
mesh         = NMesh.GetRaw(meshName)

vq   = 0
min   = MINN
max   = MAXN
for v in mesh.verts:
   if  v.co[2] >= max:
      max = v.co[2]
   if v.co[2] <= min:
      min = v.co[2]
   vq   += 1

origDeltaZ   = max-min
finalDeltaZ   = DELTAHEIGHT / satMinRadius    
factor   = finalDeltaZ / origDeltaZ

print "\n\nSatellite info"
print "   Maximum radius: %s" % SATMAXRADIUS
print "   Minimum radius: %s" % satMinRadius
print "   Delta altitude: %s" % DELTAHEIGHT
print "Original mesh info"
print "   Delta altitude: %s" % origDeltaZ
print "Final mesh info"
print "   Delta altitude: %s" % finalDeltaZ
print "Correction factor used: %s" % factor
print "Vertices processed %s" % vq

for v in mesh.verts:
   v.co[2] = (v.co[2] - min) * factor

NMesh.PutRaw(mesh, meshName)
Blender.Redraw()

#--------------------------------------------------
# This performs the actual sphere transform. This is Anthony C. D'Agostino original code:

# Copyright (c) 2000 Anthony C. D'Agostino
# http://ourworld.compuserve.com/homepages/scorpius
# scorpius@compuserve.com
# October 5, 2000
# Displacement Mapping Suite (Version 1.0)


for vertex in mesh.verts:
    theta  = vertex.co[0] * math.pi     # range was [-1, 1] now [-pi, pi]
    phi    = vertex.co[1] * math.pi/2   # range was [-1, 1] now [-pi/2, pi/2]
    radius = vertex.co[2] + 1

    x = radius*math.cos(phi)*math.cos(theta)
    y = radius*math.cos(phi)*math.sin(theta)
    z = radius*math.sin(phi)

    vertex.co[0] = x
    vertex.co[1] = y
    vertex.co[2] = z

NMesh.PutRaw(mesh, meshName)
Blender.Redraw()



I Hope this helps

Guest

Post #31by Guest » 15.07.2004, 18:22

Toti wrote:
Fridger wrote:I made a number of tests with the result, including the one displayed on Matthews new Webpage (Europa). Everything works as it should: Just fine.
I compiled the sources without a single error message. I followed the instructions to the letter, yet my Europa's cylindrical map is crossed by colour bands.


Well, I'm very curious about this, could you let me have a look at the images produced?

Matthew Arcus.

Toti
Posts: 338
Joined: 10.02.2004
With us: 14 years 3 months

Post #32by Toti » 15.07.2004, 20:46

Matthew,

First of all, thank you very much for your program. I am sure that it will help the Celestia project a lot!

These are the commands that I used (copied exactly as I entered them, as presented in your page
http://www.users.globalnet.co.uk/~arcus/mmps/europa.html)

mogrify -format ppm EuropaBall.jpg
mogrify -fuzz 20% -trim EuropaBall.ppm
project rectilinear -w 1000 -h 500 -i -f EuropaBall.ppm > europamap.ppm


The resulting image (europamap.ppm) is crossed by the banded patterns that I am referring to.
Image

If I enter this line, an "Invalid file" error message is displayed:

project rectilinear -long 60 -w 500 -h 500 -f europamap.ppm > europa1.ppm

I also tried this line (note the slightly different syntax), with the same result:

project perspective -long -60 -lat -30 -w 500 -h 500 -f europamap.ppm > europa2.ppm


I converted the image to jpg only to save some downloading time. Of course, these same effects can also be seen in the original ppm

Many thanks in advance
Bye

Matthew Arcus
Posts: 3
Joined: 15.07.2004
With us: 13 years 10 months

Post #33by Matthew Arcus » 16.07.2004, 10:13

Toti wrote:Matthew,

First of all, thank you very much for your program. I am sure that it will help the Celestia project a lot!

These are the commands that I used (copied exactly as I entered them, as presented in your page
http://www.users.globalnet.co.uk/~arcus/mmps/europa.html)

mogrify -format ppm EuropaBall.jpg
mogrify -fuzz 20% -trim EuropaBall.ppm
project rectilinear -w 1000 -h 500 -i -f EuropaBall.ppm > europamap.ppm


The resulting image (europamap.ppm) is crossed by the banded patterns that I am referring to.
...


Thanks for the info, I can see what the problem is - something has replaced carriage returns
in the output image with carriage return/linefeed combinations (so the rgb values in
the ppm file get out of step, and the resulting file is the wrong size (hence the
"invalid file" messages)).

This seems to be a feature of older Cygwins (pre version 1.8 I think), newer ones
use "binary" format throughout, hence Fridger & I's lack of problems.

MMPS uses Unix file I/O stuff (as opposed to stdlib FILEs), which I don't
think makes a distinction between text and binary files, maybe it's the redirect
that's the problem.

What happens if you do:

project rectilinear -w 1000 -h 500 -i -f EuropaBall.ppm -out europamap.ppm

so that the file output is done diirectly rather than through a stdout redirect?

Matthew.

ps. If you want to take this off the forum, feel free to mail me at matthew (at) arcus.globalnet.co.uk

Matthew Arcus
Posts: 3
Joined: 15.07.2004
With us: 13 years 10 months

Post #34by Matthew Arcus » 16.07.2004, 14:01

Matthew Arcus wrote:
Toti wrote:Matthew,

First of all, thank you very much for your program. I am sure that it will help the Celestia project a lot!

These are the commands that I used (copied exactly as I entered them, as presented in your page
http://www.users.globalnet.co.uk/~arcus/mmps/europa.html)

mogrify -format ppm EuropaBall.jpg
mogrify -fuzz 20% -trim EuropaBall.ppm
project rectilinear -w 1000 -h 500 -i -f EuropaBall.ppm > europamap.ppm


The resulting image (europamap.ppm) is crossed by the banded patterns that I am referring to.
...

Thanks for the info, I can see what the problem is


OK, looking into this a bit more, something that might fix the problem (I can't
test properly here as I don't have an appropriately old version of cygwin):

In the file image.cpp, add:

#if defined O_BINARY
#include <io.h>
#endif

immediately after the #include <fcntl.h> line.

In the Image::Write function, add:

#if defined O_BINARY
setmode (fd, O_BINARY);
#endif

immediately before the "sprintf (header,....)" line,
and do a make. You probably don't need the #if defines yourself, but I'm
interested in whether that will pick up the right things (this all assumes
that if O_BINARY is defined then io.h will exist and will define setmode
properly etc. etc.). If this doesn't compile, then try removing the -ansi flag in
the Makefile.

Matthew.

Toti
Posts: 338
Joined: 10.02.2004
With us: 14 years 3 months

Post #35by Toti » 17.07.2004, 01:39

Matthew,

Thank you for your response.
I did two things: first, I patched the code with the changes that you pointed out, and it worked perfectly. :D

After doing that, I reinstalled Cygwin, but this time with the UNIX-type linefeed support enabled, then compiled the unpatched code, and -as expected- it worked just fine.
(I installed DOS-type LF in order to assure certain compatibility with my WinMe environment)

Thank you again for your time and most useful advice.

Toti
Posts: 338
Joined: 10.02.2004
With us: 14 years 3 months

Post #36by Toti » 17.07.2004, 13:07

Hello,

Using Matthew Arcus' mmps and following the method that I outlined a few posts above, I made a preliminary low resolution 3D model of Phoebe. There was no "hand work" nor "artistic" manipulation involved, and the task only took about half an hour.
(By the way, mmps is indeed an amazing toolset)
Keeping the different lighting and shaders aside, you can compare these two Blender screens with the original data:

Textured with the composited, color cylindrical heightmap:
Image

With a plain, light material assigned:
Image

The original image:
http://saturn.jpl.nasa.gov/cgi-bin/gs2.cgi?path=../multimedia/images/small-moons/images/PIA06070.jpg&type=image

It must be converted to CMOD format. After doing this, I'll post a download link.

granthutchison
Posts: 1863
Joined: 21.11.2002
With us: 15 years 6 months

Post #37by granthutchison » 17.07.2004, 16:39

Nice!
As a comment, rather than any sort of criticism, I'd say by visual comparison with the originals that the altitude range needs to be a little wider. Comparing the outline of your lower right image with the original demonstrates this quite clearly, to my eye.

Grant

Matthew Arcus
Posts: 3
Joined: 15.07.2004
With us: 13 years 10 months

Post #38by Matthew Arcus » 17.07.2004, 16:49

Toti wrote:Hello,

Using Matthew Arcus' mmps and following the method that I outlined a few posts above, I made a preliminary low resolution 3D model of Phoebe. ...


I also had a little play with these images of Phoebe, the most obvious problem being that it isn't
very round, so a simple inverse projection might not work very well.
One simple solution that might help is to transform the input image so that
it _is_ round and then doing a simple inverse map has a better chance of
succeeding. I wrote a little utility for doing this ("circularize") and
"combine" for joining up two images of the same thing (taking maximum rgb
values from each). Made another web page of the results, see:

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

There's a new version of mmps at the usual place:

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

with these utilities in (and a fix for the CR/LF problems - thanks Toti for helping sort that one out).

Matthew.

Toti
Posts: 338
Joined: 10.02.2004
With us: 14 years 3 months

Post #39by Toti » 17.07.2004, 22:11

granthutchison wrote:Nice!
As a comment, rather than any sort of criticism, I'd say by visual comparison with the originals that the altitude range needs to be a little wider. Comparing the outline of your lower right image with the original demonstrates this quite clearly, to my eye.
Thanks for the feedback.
I assigned 115.0 and 16.0 km for the maximum radius and height difference, as posted in the NASA site. The script that I am using displaces the primitive with those values as input. Besides, there are lighting, shading and projection variables that can make the results look way different. I still think that there is some issue with that image: despite the oblong shape, there is no corresponding hue variation to that altitude change (ie. the right side of the map should turn more and more yellowish, but it doesn't). I don't want to guess the geometry, but I'd like to discuss this.

Matthew wrote:One simple solution that might help is to transform the input image so that
it _is_ round and then doing a simple inverse map has a better chance of
succeeding
I had this same idea yesterday. Still, I found the "old" mmps results quite good!
I took your Phoebe cylindrical map, removed the shading and made a new model with it (I think it is much better):

Image

Matthew wrote:thanks Toti for helping sort that one out).

I just signaled the problem, you did all the job!
You are welcome, of course :D

Avatar
Cham M
Posts: 4332
Joined: 14.01.2004
Age: 53
With us: 14 years 4 months
Location: Montreal

Post #40by Cham » 18.07.2004, 00:02

I can't wait to see this new 3ds model running in Celestia. :)
"Well! I've often seen a cat without a grin", thought Alice; "but a grin without a cat! It's the most curious thing I ever saw in all my life!"


Return to “Celestia Users”

Who is online

Users browsing this forum: 3 guests