Using Blender to Bake Icosahedral Maps

Getting back to my usual maps and planetary textures, today I am responding to the comment by Gregrox, here. I did previously make some recommendations for converting equirectangular maps to the icosahedral projection, but Photoshop and Flexify are far from freely available and, unless you’re on a Windows machine, getting Wilbur to run in Wine can be more complex than a novice user might hope for(it might also be a bit screwy in operation. So, here I will detail a method to create a map in icosahedral projection from a map in equirectangular or “latlong” projection.

As an experiment in multi-layered textures based on real-life pictures, I took some extreme close-up pictures of moss, rocks, rust and gravel around my home. In the process, which I shall describe later, I created the following spherical texture.
It’s far from perfect, but as this is simply an example used for the purpose of demonstrating a method I’ll go with this to save time.

First, we’ll open up Blender. I’m currently using 2.78a, but this really isn’t using any advanced concepts, so it should work in any fairly modern version. Delete any objects in the 3d viewport, though you may feel free to keep any lights and a camera. We’ll press shift-a and select the ico sphere mesh object. In the tool options for add icosphere, reduce subdivisions to 1. You should have what looks like a twenty-sided die in your viewport.

Next we’ll create a shader for the icosphere. In the properties panel, select the materials tab. It should look like a ball with a checkerboard pattern. For this example, I’m going to use the Blender internal rendering engine and its shaders. Hit the +button to add a new material slot. Name it “Planet Surface” if you wish. Now go to the textures tab, which is represented by a checkerboard square.  Hit the +button to add a new texture. Name it “Planet Texture” if you like. For type, select Image or Movie. Scroll down to the Image pane, tap the Open button. Next, go down to the Mapping pane. Set the texture coordinates to generated and the projection to sphere. At this point, the shader should be ready to rumble.

To take a look at what you have, set the shading method in the 3d viewport to rendered. For a more spherical view, set the shading to smooth in tools and under the modifiers tab of the properties panel(it looks like a wrench), select subdivision surface. Increase the view subdivisions to 3 and uncheck subdivide UVs.

Admire the view.

I went to a lot of trouble to remove the polar pinching, and it didn’t show up in the rotated Flexify orthographic projection at all, but somehow Blender is always good at finding the pinch. I found a little asterisk of pinching at the upper left hand quarter of the globe. I’m just hoping that doesn’t show up in the bake. Other than that, there’s little to do about it at this point…

The next step is to do the UV-mapping so we can bake this to a texture.

Go to edit mode in the 3d viewport. Hit the a key until you’ve deselected everything. Make sure that you are in edge selection mode. Select the five edges around the North Pole then flip the icosahedron over and select the five edges around the South Pole. Next select one edge across the midsection of the icosahedron.

In the tools, select the Shading/UVs tab. Scroll down to the UVs pane. Mark seam. Now open the UV/Image Editor. Tap + to create a new image. I did mine at 2048×1024 resolution. Press r to rotate and g to move and s to scale the UV outlines to fit over the image bounds.

Now go back to the Properties area, select the Render tab and scroll down to the bake pane. Set bake mode to Textures and press the Bake button.

Now go back to the UV/Image Editor to view your image.

Please try this method. If you have any questions, feel free to leave them in the comments. I’m trying to get to them more quickly than I have in the past. Even if it proves difficult to put together, once you have it rigged once, you can just plug different pictures into it and use it as is.

Thank you,
The Astrographer

This entry was posted in Mapping, World Building and tagged , , , , , , , , , , . Bookmark the permalink.

4 Responses to Using Blender to Bake Icosahedral Maps

  1. I tried following these instructions and didn’t end up with quite the same result. This was my first time using Blender, so I was an optimal test subject. I ran into three roadblocks with the instructions.

    The first was “Hit the +button to add a new material slot”, when I did that the Textures tab went away. I had to instead hit the +button to add a new material, then I could create the texture as instructed.

    The second problem which took me awhile to figure out was right before “Press r to rotate and g to move and s to scale the UV outlines to fit over the image bounds.” The missing instructions were “In the 3d viewport, hit the a key to deselect the seam edges, and again to select everything”. “In Shading/UVs, Unwrap.” and “In UV/Image Editor, hit the a key to select the UV outlines then press r to rotate…”

    The third problem was that I had to remove the subdivision modifier before I baked the textures otherwise I ended up with a UV with curves.

    I’m just using “Save as Image” from the UV/Image Editor to export the image, but I’m still getting some distortion around the tips of the image, not the perfect 60° corners as in your sample image. Any ideas what else I’m missing?

    • Astrographer says:

      The first two, you seem to have worked out well. As to the last… rather than removing the subsurf modifier, try unchecking the Subdivide UVs checkbox in the modifier. I’m not at all sure why there would be curvature in the exported image edges. Is it possible you applied a subdivide modifier before removing? Are you positive that you set subdivisions to one in the add icosphere tool options? Maybe if you could post your results somewhere, I could have a look.

  2. Turns out the last thing was “In Bake, set margin to 0px”

    • Astrographer says:

      Aha! I had some issues with that, myself, and apparently I forgot to mention it😞. Those margins can improve rendering a bit when using the uv texture to render a planet picture, but they’re no good for making a map. I’m glad you caught it. I was flummoxed.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s