Sunday, 27 November 2016

Blender FBX import - where are the UVs?

In the last couple of years, we've racked up quite a bill on the Unity Asset Store. A good few hundred quid a last. Some of this has been for plug-ins or shaders, but the bulk of it has been for models.

Quite often the characters come with animations, which is great. But if they need altering slightly, or a new animation is required, or the model needs a bit adding/removing, things get a bit trickier.

Most often, Asset store characters are supplied with the models, in FBX format. And Blender likes FBX. But when you import the model into Blender, quite often, you don't quite get what you'd expect...

Here we imported one of the soldiers from the Toon Soliders pack (an amazing character set, btw, with some really nice animations thrown in, as well as a mecanim-ready rigged character). But even after setting the view to textured the model appears as a solid, blank canvas.

If we go into our UV editor....

... there's nothing there!

Even if we select the model, and the material that came with the FBX....

... nothing doing.  We tried to load the texture into the explorer panel on the right, but the model stubbornly refused to render with the material/texture we've set.

The way to do it, is to select the model, enter edit mode, select all faces (not edges or vertices)...

Then select UV view from the bottom-left option in the menubar.

Bingo! We've now got the UV shapes - but there's still no sign of the texture. To fix this, in UV view, load the appropriate texture/png from disk.

If you've selected the right texture, everything should line up just right. Go back to 3D view and, hey presto!

Now our imported character looks just like he should, when used in Unity. To prove this, save the entire .blend file into your Assets folder and flip over to Unity. Drag-n-drop the character into the scene (Unity automagically imports .blend files using the built-in FBX importer, so no need to export again) and apply an animation.

Choose the most appropriate shader for the model, by selecting the character in the explorer, expanding the list and selecting the mesh:

Hit play, and watch your (Blender modified) character come to life!

No comments:

Post a Comment