1
$\begingroup$

Background: I am attempting to create a Unity application for viewing asteroids. I have a wavefront object that I got from NASA's PDS SBN. Right now, I am looking to replicate the version of Eros from the 3D Asteroid Catalogue (click "Grayscale" on the website to see the texture), but in Unity instead of ThreeJS. I believe I need to create a UV map in Blender so that I can apply it to the object in Unity.

Thanks to lemon in a previous post, I was able to get a cylindrical texture map on the asteroid. But I did not realize that I couldn't import this directly into Unity.

For reference, the wavefront file I'm using is located here, and the simple cylindrical projection I'm using is located here (warning, large image file).

Question: I have a wavefront object and a texture which is an equirectangular projection. I want to apply this equirectangular projection too the object in Unity.

I believe that I need to do this by getting a UV for the texture. To create a UV, I want to unwrap the object's mesh in a way that is identical to an equirectangular projection. What is the best way to do this?

Attempted Solutions: Here is an image of the working equirectangular projection in Blender:

Equirectangular projection

That works well, but this does not import to Unity. So I attempted to create a UV map that emulates the equirectangular projection. I unwrapped the mesh as a cylinder and applied it to the asteroid with an image texture node. Here is what the unwrapped mesh looks like:

cylindrical unwrapping

I'm not sure if this is the right unwrapping or not, because when I try to display the asteroid, I get something very garbled. Here is a picture of my attempt at rendering the asteroid with its texture on:

Attempted UV mapping version of equirectangular projection

I'm confident that I am applying this completely wrong, I'm just not sure why. Here is what my unwrapped mesh looks like -- the entire asteroid is covered, so the streaks & the weird band around the asteroid don't make

$\endgroup$
1
  • 1
    $\begingroup$ You can bake the diffuse from the mesh of the previous question/answer to a new mesh with a 'standard' UV map (you ll need to use Cycles render engine to do it).. $\endgroup$
    – lemon
    Feb 25 '20 at 5:01
5
$\begingroup$

Two bake solutions.

Bake from the original object

A solution can be baking the model from this answer on to a copy of the mesh.

To do that:

  • From the original mesh, enter edit mode and unwrap it (the way you want, smart UV project will do).
  • In object mode duplicate the object, so that both original and copy will have a UV map which will be needed to bake even if the UV map of the original mesh is not directly used.

The UV map I have created is the following:

enter image description here

  • Create a new material for the copied mesh.
  • Add a unconnected image texture in it, call it for instance 'bake' and save it to disk.

Like so:

enter image description here

Now the bake setting:

  • Use Cycles and if possible GPU
  • Set the bake mode to diffuse (we want the color)
  • Influence color only (for the same reason)
  • Selected (original mesh) to active (target mesh)
  • Ray distance to some little amount to avoid overlapping effects between the two meshes

enter image description here

Now make sure the two objects are at the exact same position.

Select the original mesh, shift select the target, and use the bake button above.

Here are the resulting meshes:

enter image description here

(I cannot share the blend file as too large for this site).

Bake from the environment texture

Another possibility is to bake from the environment texture.

As we know that the original texture is an equirectangular projection, we can set it as environment texture.

Here too the object is previously unwrapped the way you want.

The bake setting is simple (the object will have to be at the world center):

enter image description here

Now we have to setup the environment texture. As for your previous question the tricky part is to find the good mapping in this context (180 degrees and inverted axis):

enter image description here

Once done, select your object and hit the "bake" button.

The result is similar:

enter image description here

$\endgroup$
8
  • $\begingroup$ I am trying to bake from an environment texture, and I am getting a different result from what you showed. Only a portion of my asteroid is getting mapped to, and that portion shows a lot of blurred lines. Here is an example of what I see: imgur.com/gallery/t2zVhRI --- Am I using the wrong image for my mapping? $\endgroup$
    – Taycan
    Feb 26 '20 at 4:46
  • $\begingroup$ You should use a square texture like 4096x4096. $\endgroup$
    – lemon
    Feb 26 '20 at 5:52
  • $\begingroup$ That may be related to my problem. Right now, I create a blank square rectangle and unwrap my asteroid onto it. Then I set up the world nodes and I bake the texture. But when the bake is finished, the UV mapped image changes from my square to the rectangular texture image that I'm using as the environment texture. Do you know what is causing the environment texture to bake onto this rectangle instead? $\endgroup$
    – Taycan
    Feb 26 '20 at 7:28
  • $\begingroup$ That can be due to the material setting of the object. Is it like the second image of the answer above? $\endgroup$
    – lemon
    Feb 26 '20 at 7:34
  • $\begingroup$ The material of the object was set to my texture file (i.imgur.com/j2FlNRb.png). I also tried changing it to a blank image called "bake" and I got a similar result to before (i.imgur.com/7WWX8KI.png) -- changing to a blank rectangular image did lead to more coverage on the asteroid, but it's still very stretched. I think I may be missing a crucial step in this process. $\endgroup$
    – Taycan
    Feb 26 '20 at 7:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.