# Mapmaking Discussion & Philosophy (WIP/Critique) > 3D modeling (map elements and height maps) >  3d scan of imperfect globe to a 2d Equirectangular Projection

## Vigilus

This is for the 3d Vaeya globe project I have in the world mapping section of these forums.  

I'm using blender.

Just trying to find a way to reshape the UV map in such a way that the 3d globe comes out looking like a regular equirectangular projection.  


This picture shows the rough layout of the UV map.  As you can see, it's nowhere near an equirectangular projection.



I'm working from this imperfect sphere (which was a 3d scan that's been touched up, no mesh work has been done).



Here is what the mesh looks like overlaying the UV map

----------


## Vigilus

That's a lot of views and even more silence from the guild members.  I'm at least receiving responses on other websites.  I thought this was a place where we help people?

----------


## Greason Wolfe

Well, what kind of help are you looking for? I, for one, have nothing to offer since I don't use Blender and have no experience with what you are trying to accomplish. There might be others here that can offer something, but if they don't know what you're looking for, it's hard for them to respond in a helpful way.

----------


## Vigilus

I'm going from a 3d model to a 2d equirectangular projection.

----------


## waldronate

I am unfamiliar with an 2D Equilateral projection and I don't use Blender. I will guess that you meant "Equirectangular", where the vertical mapping linearly maps the latitude range -90 to +90 degrees to the pixel height of your image and maps the longitude range -180 to +180 degrees to pixel width according to the relation 1/cos(lat) (that is, progressively more stretched toward the poles). In this case, the UV (longitude,latitude) outputs have a simple relationship to things on the globe as described above.

Your first image looks like it has a texture atlas stitched together onto a single image with some external mapping defining the texture-to-sphere coordinates. If you have access to this mapping, you should be able to transform it to points on the sphere and then split up your sphere into some uniform set of triangles and project the pixels from those triangles onto an equirectangular bitmap. In that case, more triangles would give better results, right up to the point where you have triangles that occupy a single pixel in the output image.

Another option would be to take a few images in Blender using an Orthographic projection (view of the sphere from infinity) down each axis of the sphere and then feed them into program that will convert those images into an equirectangular bitmap (I'm partial to ReprojectImage from http://fracterra.com/ReprojectImage.zip mostly because I wrote it and am familiar with it). This sort of thing can be done with many of the common panorama stitchers.

Blender should be able to render cube maps and that cube maps can generally be converted into equirectangular without too much effort. See your local search engine for more information. Your best bet in that case is to put the camera at the center of your sphere, because then the entirety of the generated cube map will be your sphere.

----------


## Vigilus

Wow Waldronate, that's some serious help, tomorrow will be spent learning these key words and likely a PM or two your direction.  Thank you very much! 
I've been so frustrated with this problem for just good starting material that I'm starting to look deep into search engines and find a better one than google.  
I've discovered a really handy cube map tool specifically for equirectangular projections from a sphere that everyone might like: https://www.youtube.com/watch?v=oklmDQx17HI&t=12s 

I've had this annoying habit where I've been substituting equirectangular with equilateral and my brain just can't kick the habit.  I've updated the thread with the appropriate terms.

The main issue I'm having at this moment is transposing my imperfect sphere onto a slightly smaller, perfect sphere, so that I can clean up the whole process and start applying algorithms.

Again, Thank you Waldronate!

----------


## waldronate

Let us know how it works out.

----------


## johnvanvliet

if the 3d sphere looks good in Meshlab then it will look good in Blender 
now the xyz rotation might be off but  the is easy to fix 


then exporting a  equirectangular projection is also rather easy 

so first when you view it in blender dose it look fine or all mixed up ?

if it looks fine then all you need to do is "bake" the texture to a second sphere that is UV mapped to a sphere and not UV islands

----------


## Vigilus

> if the 3d sphere looks good in Meshlab then it will look good in Blender 
> now the xyz rotation might be off but  the is easy to fix 
> 
> 
> then exporting a  equirectangular projection is also rather easy 
> 
> so first when you view it in blender dose it look fine or all mixed up ?
> 
> if it looks fine then all you need to do is "bake" the texture to a second sphere that is UV mapped to a sphere and not UV islands


Thanks for your reply johnvanvliet,
To answer your question, the 3d view looks fine, all the UV mapping onto the sphere is spot on and I've done extensive painting using photoshop and 3d painting in blender. 

I've done research into baking, yet the videos lack context and an overall process.  Without context they don't mean anything practical, it's all academic. I'm hoping to find a lot more context of this process from you guys/gals.  Any good baking videos that you link would be appreciated.




> To answer your question, if it looks fine then all you need to do is "bake" the texture to a second sphere that is UV mapped to a sphere and not UV islands


Thanks, this is slightly more specific than the replies I've been getting on other websites.  Can you go into detail about the process? Maybe a video link or a make a quick video of what you mean precisely?  

@waldronate, I will, and I'm still looking into your solutions

Thank you!

----------


## Vigilus

Also, here's an updated pic where I'm adding more depth to the world by adding in mountainous regions to tie in everything to make the world less "standard game board art style".



I was hoping to additionally bake the mountain textures into the model as well, trying to preserve the general shading so that I can go extremely detailed later in Photoshop and other programs.  I'm trying to preserve the hand painted textured mountains that I scanned off of the original hand painted globe.

Any lighting pointers and techniques on this would be very helpful, also, is it just a normal map bake for that process?  If I "bake everything" or "bake all channels" in blender would that be enough?  Feel free to correct anything in quotes with better terms.   :Wink: 

Thanks!

----------


## Vigilus

@ Admin(s) could you correct the post name from "equilateral" to "equirectangular" please?

@ Waldronate, I sent you a PM.  I don't have access to the atlas mapping as that came with artec studio 12 and I no longer have the seat license.

----------


## Gidde

Corrected as requested.  :Smile:

----------


## selden

I'm confused by all this "baking" and stuff. Why not reproject your orthographic image as an equirectangular image and use that as a surface texture on a globe?

FWIW, I used this procedure with your most recent image:
Use IrfanView's "autocrop" menu item to eliminate the border (ImageMagic's "trim" refused to work correctly for me.)

use ImageMagic convert to scale the 748x757 image to be 1024x1024 (I'm rashly assuming that the squashing was linear)
 ( convert Globe_Game_cropped.png -geometry 1024x1024! GGs.ppm )

use MMPS to project from orthographic to equirectangular (2048x1024)
  ( project -i orthographic -lat 0 -long 0 -w 2048 -h 1024 -f GGs.ppm > GGso.ppm ; convert GGso.ppm GGso.png )

use Celestia to draw a globe with that surface texture.

Below are framegrabs of the final result. The first framegrab compares the globe drawn by Celestia to your most recent image. The second screengrab  is just to show the distortion in the surface texture image at the borders, where they're stretched onto the surface of the sphere. The third picture is the equirectangular surface texture image that I used.

----------


## Vigilus

@ Selden

Wow!  That looks great even in low res.  I think this was another way of explaining what Waldronate was talking about earlier (if not feel free to correct me @Waldronate).

I'm going to take some Blender (Orthographic view) renders of the 6 hot-keyed views (left, right, front, back, top, bottom) and see if I can get that to work.  I'm trying to take the 3d .obj/jpg file I have and turn it into a high quality, high res 2:1 aspect ratio (equirectangular projection) map.  

@Waldronate How to set up my outputs so that your program can take high resolution files to map it?  Trying for 8k resolution as an output if I can get it.  Thanks!

Getting the precision of the equirectangular projection is key, as I'm trying to have as little distortion as possible when this gets applied to the manufacturer's template.  Every small distortion can undo the carefully crafted design that makes the piece so eye catching.  The point of the project is to prove that human designs are superior to computer generated RNG "designs", so distortion hurts that cause.

That's a good thing for cartographers everywhere, it increases our market value directly in an employer's eyes.

From a practical board game perspective I can touch it up easily enough and it will look great.

The original artwork was a slowly, exhaustively designed hand painted globe, so its from 3d to 2d; you probably know this, but I state this again just in case.

@Gidde Thanks!

----------


## selden

> @ Selden
> 
> Wow!  That looks great even in low res.  I think this was another way of explaining what Waldronate was talking about earlier (if not feel free to correct me @Waldronate).


I think the processes are similar, although certainly not identical. I prefer scripted solutions, while Waldronate's ReprojectImage has a GUI interface.



> I'm going to take some Blender (Orthographic view) renders of the 6 hot-keyed views (left, right, front, back, top, bottom) and see if I can get that to work.  I'm trying to take the 3d .obj/jpg file I have and turn it into a high quality, high res 2:1 aspect ratio (equirectangular projection) map.


What types of images did you import to Blender?
(I'm wondering if the use of Blender could be bypassed, with the reprojection done directly, translating just the images.)

However, if the goal is to produce a physical 3D object, .obj models can be used as inputs to 3D printers. I suspect there are better ways to produce accurate spheres with smooth surfaces, though. Or do you intend to produce globes with bumpy, mountainous surfaces?

Coloring the surfaces of those objects is a separate issue, of course, which is what I'm assuming you're trying to do.




> @Waldronate How to set up my outputs so that your program can take high resolution files to map it?  Trying for 8k resolution as an output if I can get it.  Thanks!


What do you consider to be "high resolution?"
Unfortunately, the current version of ReprojectImage seems to have a maximum output resolution of 4Kx2K. 

FWIW, the command line program that I use (MMPS project) was able to convert an 8Kx8K orthographic projection to a 16Kx8K equirectangular projection. 



> Getting the precision of the equirectangular projection is key, as I'm trying to have as little distortion as possible when this gets applied to the manufacturer's template.  Every small distortion can undo the carefully crafted design that makes the piece so eye catching.  The point of the project is to prove that human designs are superior to computer generated RNG "designs", so distortion hurts that cause.
> 
> That's a good thing for cartographers everywhere, it increases our market value directly in an employer's eyes.
> 
> From a practical board game perspective I can touch it up easily enough and it will look great.
> 
> The original artwork was a slowly, exhaustively designed hand painted globe, so its from 3d to 2d; you probably know this, but I state this again just in case.
> 
> @Gidde Thanks!


(to rephrase my initial question)
How are you translating the globe that you created into surface texture images?
Are you using a camera to take pictures of it? If so, what model of camera is it and how many megapixels are involved (since that's how cameras often are rated)?

----------


## Vigilus

@ Selden




> What types of images did you import to Blender?


I imported the .obj file and the UV map as a .jpg file (I didn't know about compression then, wish it was .tiff!)





> Or do you intend to produce globes with bumpy, mountainous surfaces?


I'm going for the shading and lighting of the mountains on a physically smooth surface.  Cheaper and still pretty to look at, avoiding the annoyance of magnets on bumpy surfaces as well.  This is where I think baking would be a good solution.




> What do you consider to be "high resolution?"


8192x8192 is what the industry standard is.  Although there is a lot of debate, the quality gained for the time to make and find workarounds for programs that don't support high resolutions starts to taper off at that number. 




> FWIW, the command line program that I use (MMPS project) was able to convert an 8Kx8K orthographic projection to a 16Kx8K equirectangular projection.


I'll have to check that out, thanks for telling me about it.




> How are you translating the globe that you created into surface texture images?


The camera at the object's origin, in orthographic view, 6 Renders in Blender along the preset views of: left, right, front, back, top, bottom. 8192x8192, outputting as a .tiff file.  I don't know if this is going to work or if these are the correct settings.




> Are you using a camera to take pictures of it? If so, what model of camera is it and how many megapixels are involved (since that's how cameras often are rated)?


I originally used an Artec Space Spider to 3d scan the physical globe into the digital medium.

----------


## waldronate

I think Selden has this under control.

----------


## selden

> I think Selden has this under control.


I don't  :Wink: 

Is there any chance that ReprojectImage could be enhanced to handle images as large as 8192 x 8192 ?

While I'm comfortable recompiling and using command-line utilities like MMPS, many people prefer GUIs.

----------


## selden

> I'll have to check that out, thanks for telling me about it.


For more information, see http://www.users.globalnet.co.uk/~arcus/mmps/

A limitation of MMPS is that it was written for Linux. While I found it relatively easy to recompile it for use with Cygwin under Windows 7 (which is what I use), others might be less comfortable doing that. (In principle, at least, I could provide the Windows binaries.) An alternative, if you aren't already using Linux, might be to use one of the Linux environments available for Windows 10.



> The camera at the object's origin, in orthographic view, 6 Renders in Blender along the preset views of: left, right, front, back, top, bottom. 8192x8192, outputting as a .tiff file.  I don't know if this is going to work or if these are the correct settings.


That procedure seems reasonable to me. Combining the resulting images so their borders aren't noticeable might be challenging.  



> I originally used an Artec Space Spider to 3d scan the physical globe into the digital medium.


Aha! Not as simplistic as I was thinking.  :Smile:

----------


## waldronate

> Is there any chance that ReprojectImage could be enhanced to handle images as large as 8192 x 8192 ?


http://fracterra.com/ReprojectImage64.zip has a 64-bit installer with no imposed upper limit on size (it will crash when it hits some OS limit or other rather than just refuse to export above a certain size).

----------


## selden

> http://fracterra.com/ReprojectImage64.zip has a 64-bit installer with no imposed upper limit on size (it will crash when it hits some OS limit or other rather than just refuse to export above a certain size).


Thanks! 

It doesn't crash wheh it loads a 16Kx8K image, but its proportions are wrong. Rather than usurp this thread for bug reports, I'll send you a PM.

----------


## Vigilus

> http://fracterra.com/ReprojectImage64.zip has a 64-bit installer with no imposed upper limit on size (it will crash when it hits some OS limit or other rather than just refuse to export above a certain size).


Awesome I'll check it out!

@ Selden

Yep that's it's achilles heel, i'm not going to learn another operating system to use it.  
I'm eagerly awaiting the day for direct skill downloads via my cybernetic implant to instantly learn all of this technical drudgery.  Until then I'll focus on making an amazing player experience.  

Thanks for your help Selden, sadly I don't this is the solution for my problem.  Jonvanvliet seems to have the solution I'm looking for, if he could go into depth on it even a little bit.

@jonvanvliet
I'll PM you

----------


## johnvanvliet

i am about to leave for work in a few min. so later tonight / tomorrow i will get back to you about blender and meshlab

----------


## Vigilus

> i am about to leave for work in a few min. so later tonight / tomorrow i will get back to you about blender and meshlab


Thanks John!

----------


## johnvanvliet

there normally will be two ways to do this 

the first is to "bake" a texture using "blender render" 
the second is using the camera and nodes in "cycles render" 

as in the old way VS the new way 


i am assuming you can switch from blender render to Cycles Render and back 


i am also guessing you are by default in blender render 

so for that you need to make a UV sphere just slightly bigger than the mesh you have 
uv map it to spherical projection 
in the outliner window ( top right corner ) click on your world 
hold down < control> and click on the new uv sphere 

then under bake select "texture" then click the  bake button 



for cycles and nodes ( better results ) 

move blender  into cycles render
check " use nodes" box in miterales to creat a new node set up 
add a new image texture node and in the drop down menu should be the textues name you are using for the oddly mapped textuer 

add a emission shader ( this will cause the texture to glow)

add a camera at the center and set it to equal area projection 
( you might need to rotate X + 90 degrees ) 
*--- sounds very complex but really it is not* 
and render 


it might be easiest if you can pack the texture into the "*.blend" file and post  it 

-- with blender running and everything looking good select from "file" ( top left ) "external data / pack all into blend " 
then post the blend file ( might have to zip it for some services to except it ) 
i know that my FREE google storage ( from using gmail) will handle a blender blend file just fine 

this way i can set things up for you and you can then study what i post back

----------


## Vigilus

> there normally will be two ways to do this 
> 
> for cycles and nodes ( better results ) 
> 
> move blender  into cycles render
> check " use nodes" box in miterales to creat a new node set up 
> After this text is where I'm having the issue------add a new image texture node and in the drop down menu should be the textues name you are using for the oddly mapped textuer 
> 
> add a emission shader ( this will cause the texture to glow)
> ...


Normally, just to see my texture at all I have to be in texture paint mode on the object while the object is selected in the scene.  
When I go to materials I don't have any drop down menu showing a selectable .jpg texture file.  
The texture on the added material is all white, even when I rename it to the existing texture and select the new one.

Thanks for taking the time to give an more detailed answer!




> add a camera at the center and set it to equal area projection


 ---Do you mean Orthographic Projection?

----------


## Daniel Gimenez

Wow, I am trully fascinated how many messages went into a simple projecting issue.

You know as a 3D artist I have to deal with this all the time, scanned objects have bad topology and their UVs are all over the place.
I know this might be a bit late but to me the problem is simple:

-You have one object where the texture looks nice when wrapped but the UVs are a mess.
-You can make an object that is exactly the same but with a better UV layout. For example in Blender you can create an UVSphere and select automatic UVs, you will get an equirectangular projection.
-Should you also want to transfer to the new sphere also geometrical deformations I would go over to zbrush to project the geometry to the new perfect sphere, but I believe there is a way of doing it in blender using one of the modifiers that changes the shape of one object to a target, thus you would en up with two identical spheres but one having correct UVS.
-If the objects match up, with a program like xNormal you can project the texture of the first object to the new sphere, and voila.

I hope this helps a little bit at least, maybe I am not getting the real problem,

Daniel.

----------


## Vigilus

@ Daniel

Thanks for the response!  

Your approach seems to be right on target as far as I can tell on initial observation.
I'm going to look into this path.  I've had this issue before the eyes of the blender artists community, polycount and this forum.  So far the problem remains unsolved and I have my handy new christmas gifts in hand, Blender for Dummies and Mr. Blain's Blender Graphics book.  I keep getting that it's really simple yet nobody seems to know how it's done.  I'm going to play with your idea, thanks for the new software mentions!

----------


## Vigilus

I haven't looked at this post in a long time.  After rereading this haphazard search, I never updated the solution I eventually found. Sorry about that!  I found this guy who had a program that would take many, many pictures of a virtual object.  Then the pictures are easily mapped onto an equirectangular projection. After a week of emails and sending one file, he had it perfectly mapped out with almost no detail loss whatsoever.  This process has had a few years to grow since then, so check out it.

----------


## kennystone

I agree, xNormal is a very convenient program for baking ready-made cards!

----------

