4
$\begingroup$

I have a problem.

I would like to wrap the map around a sphere. My current iteration is a Robinson projection.

I found some similar problems in the forum, but unfortunately, they do not fit my problem exactly. In their cases, they had only one mesh to wrap around. So they used the Simple Deform modifier. In my case, the meshes cannot be joined. because of the USDZ export later. I need one sphere with multiple meshes on it. Does somebody has an idea how to wrap all meshes around one sphere ?

enter image description here

$\endgroup$
10
  • $\begingroup$ @DuarteFarrajotaRamos this is an example as I described it. He can wrap it, because he only has one mesh. So he can use the modifier. But how can I organize it with multiple meshes to wrap it like he did. $\endgroup$ Commented Apr 22 at 19:02
  • $\begingroup$ The same way, use the same modifier on each object, no? $\endgroup$ Commented Apr 22 at 19:06
  • $\begingroup$ @DuarteFarrajotaRamos this was the same what I thought. But it does not work for me, because every object bends 360 degree and not all together. Maybe, I am doing something wrong, as I am a beginner. $\endgroup$ Commented Apr 22 at 19:19
  • $\begingroup$ @Lutzi Cylindrical. But I imported it as an SVG and converted them into Meshes. Now I need to wrap it around as you would to with the modifier "Simple Deform". The only problem is that the map is out of many mashes. So I cannot wrap it like one mesh. I need a function to wrap the meshes as it would be one mesh. $\endgroup$ Commented Apr 23 at 6:08

1 Answer 1

10
+100
$\begingroup$

From Robinson projection map to globe (Geometry Nodes)

All of your meshes are composed of one big n-gon face. This can't work well with deformations. I won't be treating this problem, which isn't the initial question. Feel free to open another question about it.

I went a bit overboard and tried a mathematical approach. I'm using this Wikipedia article on Robinson projection as a reference. I've simplified the math behind it, so I'm not a 100% sure my solution is exact. Either way, it looks visually right.

1. Mathematical formulation

I won't go into much details, please refer to the wiki article. I've simplified as much as possible the 2 formulas for latitude and longitude.

enter image description here

  • Latitude is simply equal (or proportionnal) to y-position on the map. In our case, meshes being upwards, it will be the z-position in the geometry nodes.
  • Longitude needs the XY table to be computed. We'll see in the next section how to get it.

2. XY table

The Robinson projection uses an XY table. We are supposed to interpolate this table to get any value between 0° latitude and 90° latitude. If drawn as a graph, it would look something like that :

enter image description here

Conveniently, Curves in Blender can easily be interpolated by changing the curve type. No math required, which is nice. Keep in mind that this interpolation doesn't match what is usually recommended for this projection type.

So, we can build a Poly curve ("1" in next image) then change the curve type to obtain a smoother curve ("2" in next image). Below is a visualization just for 3 points.

enter image description here

3. Scene setup

First we want to follow this conditions :

  • Center meshes on origin. We don't need to center along the y-axis, but we need to center the meshes along x and z axis. I've used an image as reference to align. X-axis should be aligned with the equator.
  • Apply scale for all meshes : A, then Ctrl+A > Apply Scale.
  • Apply rotation for all meshes : A, then Ctrl+A > Apply Rotation.

enter image description here

The meshes are ready, and we already know the maximum z positions (which correspond to the on-map y coordinate).

4. Geometry Nodes

Let's see first the latitude nodes. Note that we need to add the position of the current object to get a global position (from the origin of the scene). The idea is to map the global z-position to the latitude, which means in our case mapping as follows : $( -1.3 , 1.3 ) \rightarrow (\pi, -\pi)$.

enter image description here

Then for the longitude, it works the same way :

enter image description here

But we need to extract the X value from the XY table. The setup is as follows :

enter image description here

The left block generates the curve with the provided XY table, for 19 points. Then we set the x and y positions to match the XY table, and we change the curve type to Catmull Rom (feel free to experiment here, but I didn't see any difference on the final result).

The right block samples the curve at the exact current point. We again map the z position to the (0,1) interval, interval which is used as factor on the curve.

For the XY table, I've manually filled a Index Switch node from the wiki article.

enter image description here

We can finally create spherical coordinates based on the latitude and longitude (used as rotation). I'm starting with the vector (0,-1,0) and rotating it first along the x-axis (latitude), then along the z-axis (longitude)

enter image description here

I've linked both the scale and position to an empty Globe transform so that you can easily move and scale your globe.

5. Duplicate Geometry Nodes

You can copy the Geometry Nodes to all meshes as follows :

  • Select all meshes A
  • Have the mesh with the GN being active
  • Copy to Selected

enter image description here

6. Final result and blend file

Here is a preview of the result, alongside the blend file. Let me know if something it not clear.

enter image description here

7. Unresolved issue

As said at the beginning, your meshes are bad for deformation. N-gon faces work for flat surfaces, but you need more geometry to have nice deformations. Here is an example where this is quite visible.

enter image description here

Blender can't know what should happen with the surface if there isn't any vertex besides the outer ones.

I encourage you not to try to solve this issue in this question. If you need help about it, open a new one.

$\endgroup$
6
  • $\begingroup$ First, thank you much, I really appreciate the effort you put into the solution. I will go to each step and I am optimistic I will learn a lot. I wanted to check the blender file you linked. When I download it, I receive an undefined file, not a .blend file. And if I open this undefined file in blender, I can see all the geometry nodes for example, but I can only see a line that displays a semicircle. Could you please check it $\endgroup$ Commented Apr 25 at 10:55
  • $\begingroup$ @PascalMeger I don't know why but yes the file doesn't have the .blend extension. If you add .blend it should open correctly. Also, I've done it in Blender 4.1.0, earlier versions may not be compatible. $\endgroup$
    – Lutzi
    Commented Apr 25 at 12:24
  • $\begingroup$ Because of your help, I was able to create a prototype for an app. Now I want to create a MVP. For this, I need to work with a map with a mercator projection. My first idea was, that I can reuse the Node geometry, but calculate new x and y values. Is it right or am I missing something? $\endgroup$ Commented Apr 30 at 16:04
  • $\begingroup$ Yes you could with other projections. $\endgroup$
    – Lutzi
    Commented Apr 30 at 21:13
  • 1
    $\begingroup$ As for p. 7.: blender.stackexchange.com/a/324567/60486 $\endgroup$ Commented Sep 19 at 20:54

You must log in to answer this question.

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