Cedeon Design

Blender - Sphere Map to Cube Map : Successful

Blender: How to Convert (bake) a Sphere Map into a Cube Map

Posted by Cedeon Design. Categories: Blog.

Hi There…

So I’m guessing if you’ve tried this you probably ended up somewhere like this…

Blender - Sphere Map to Cube Map : Fail

Blender – Sphere Map to Cube Map : Fail

That’s where I ended up first and it was frustrating.  I knew what i wanted to do but after much googling around I didn’t see a workable solution..


The Cube of Fail:

Blender - Sphere Map to Cube Map : Cube of Fail

Blender – Sphere Map to Cube Map : Cube of Fail

The above image shows my first attempt.  I had a UV unwrapped unit sphere with my blender hemispherical 360 degree render, correctly mapped.  I wanted to project this onto a cube map.

After a while thinking about this problem, It occured to me that if we were to have a bunch of normals all pointing to a singular point, in this case world origin.. a bake could still work.

Normal Edit Modifier to the rescue!

The solution was to first subdivide the cube, in my case i made 64×64 faces on each cube face.  I then made an empty at the world origin and set a ‘Normal Edit’ modifier on the cube in directional mode with the empty set as the target object.  If you do this make sure you set your faces to smooth shading, that was a bit of a Gotcha for me.


The Cube of Normal Goodness +1:

Blender - Sphere Map to Cube Map : Correct Normals

Blender – Sphere Map to Cube Map : Correct Normals

As you can see above, the normals are now all facing that singularity point and a bake from the sphere to the cube should now work- and it did!.. There was a tiny seam at the edges, if any of you try this and are able to resolve that issue let me know!  Im thinking its a rendering antialiasing issue.. maybe tweak the settings or make the cube faces overlap a smidge?  Thoughts? – Twitter: @cedeon.


The Cube of Success:

Blender - Sphere Map to Cube Map : Cube of Successful

Blender – Sphere Map to Cube Map : Cube of Successful

 

Anyway it solved a problem for me – onwards to Unreal Engine!