3
$\begingroup$

I have a portion of a map, with its coordinates, and I want to project it in its correct position on a sphere, like on a planet. This map is a geotiff image with its geographic coordinates.

I traid to insert it as an image texture into the sphere, and then adjust the map position on the sphere manually, but that solution is imprecise. Plus, I would like to add several maps on the same sphere, and I need to manteind the correct position of them.

Is there any way to put the map in its correct coordinates with blender?

This is one of the images (from Mars), as an example: enter image description here

And this is what I need:

enter image description here

$\endgroup$
11
  • 1
    $\begingroup$ Hello :). Please add na image to illustrate what kind of map you have. $\endgroup$ Commented Oct 9, 2020 at 13:48
  • $\begingroup$ Recommend the blenderGIS addon. $\endgroup$
    – batFINGER
    Commented Oct 9, 2020 at 13:58
  • $\begingroup$ related: blender.stackexchange.com/questions/3315/… $\endgroup$
    – brockmann
    Commented Oct 9, 2020 at 14:32
  • $\begingroup$ how is it supposed to be projected on the sphere? $\endgroup$
    – moonboots
    Commented Oct 9, 2020 at 14:58
  • 1
    $\begingroup$ Started an answer based on combining blender.stackexchange.com/questions/159483/… and overlaying the map image based on its corner coords mapped to its portion of the equirectangular UV (latidude x longitude). However nodes isn't my strong suite. Could post the theory and links to setup without final node setup? $\endgroup$
    – batFINGER
    Commented Oct 9, 2020 at 16:43

1 Answer 1

4
$\begingroup$

Considering the map part corresponds to an equirectangular projection, we can do a plane to sphere deformation by the approach indicated here.

Making a sphere from a grid

The base grid should be in the proportions of width/height = 2 as we map as longitude is 360 degrees and longitude is 180 degrees.

If the grid is parallel to the front view, we can give it some flat subdivisions and bend it 180° around X and 360° around Z.

To unwrap it (as we'll use UV mapping), still in front view and edit mode use U then "Project from view (bounds)".

enter image description here

The shader to place the map part

From the given image, we can see that the map part is (approximatively) from -160° to -126° in longitude and from 28° to 64° in latitude.

What we have to do:

  • Determinate if a given point is inside the map part
  • Remap this map part at the position given by its coordinates ranges

In X (or U) in the UV map, a given coordinate is between 0 and 1. The longitude is between -180 and 180. So we can shift the map part coordinate by 180 and divide it by 360 to go from the longitude space to the UV space.

Same thing from Y (or V).

With this calculation (done by AddDivide node group in the blend below) applyed to the map part coordinates, we can test if a given UV map point is inside the map (done by Between node group in the file below).

This first calculation indicates if the texture has to be drawn on the sphere for a given UV map point.

Now to draw the texture at the wanted location, we need to remap the UV point to the texture space in the good location and proportion.

This is done by substracting the min map coordinate in UV space with UV point coordinate then divide that by the map range in UV space.

X in texture space = (X in UV space - min map X in UV space) / (max map X - min map X in UV space)

This part is done by Remap01 node group in the file.

Last, we combine all together in a single node group so that you can apply it to several map parts.

enter image description here

This node group is called RemapEquirectangular and has the following parameters: the UV coordinates, min and max longitude, min and max latitude.

The result is the following:

enter image description here

$\endgroup$
8
  • $\begingroup$ Thankyou can't wait to test it out. eg astrogeology.usgs.gov/search/map/Mars/Mars2020/… has the geospatial data (looks like OP has used his phone for that image) $\endgroup$
    – batFINGER
    Commented Oct 16, 2020 at 8:29
  • $\begingroup$ @batFINGER, don't know what to download in this link? Tried some tif but no coordinates on it. Other thing: you mentioned a file that crashes you computer previously. Do you want me to have a look? $\endgroup$
    – lemon
    Commented Oct 16, 2020 at 8:53
  • $\begingroup$ Just grab the image... astropedia.astrogeology.usgs.gov/download/Mars/Mars2020/… Here is what I'm using for low res global EP attic.gsfc.nasa.gov/mola/images/shade_med.jpg Scroll down to where it details the geospatial info Feature Name Jezero crater Minimum Latitude 18.211 $\endgroup$
    – batFINGER
    Commented Oct 16, 2020 at 9:01
  • $\begingroup$ @batFINGER, ah... ok. Get it. $\endgroup$
    – lemon
    Commented Oct 16, 2020 at 9:07
  • $\begingroup$ (the tiff is a geotiff has geospatial data in meta and is a grid of elevation values blenderGIS deals with this well) or to play around with check out GDAL tools $\endgroup$
    – batFINGER
    Commented Oct 16, 2020 at 9:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .