Problems importing FBX file

Hi,

I have made a spaceship with Blender and I’d like to import it to my game.

I extracted the materials in Unity and obtained these:

I was surprised about this because the 3D model is divided into multiple objects, as you can see:

So let’s talk about the weirdness of this import.

I applied the emissive map and it looks like this in Blender:

But like this in Unity:

I tried to play around with the intensity, but - if I lower it - I don’t get white windows as expected.

There’s also an hemblem in the sail in Blender:

but nothing in Unity:

Another weird thing is that I exported these maps from Blender:

But only some of them can be applied on Unity:

I’d be greateful for some help.

Unity doesn’t really fully import materials from Blender. Just set up your own Materials in Unity, using perhaps textures from your project…but you do need to unwrap stuff properly in Blender first, and you can paint the texture there too.

Yes, you can start from the Materials that Blender imports, but already I can see that the sail texture is likely tinted some color (yellowish) that you set in Blender.

It also looks like at least part of your sail is incorrectly UV-mapped.

Get a default UV grid “test” map texture (or two) and put it on your materials so you can begin to reason about what is happening:

Here’s more about Blender and Unity:

When I work in Blender3D for Unity3D use, I follow these organizational rules:

  • use Empty Blender Objects as folders: they come out as an extra GameObject

  • ALWAYS parent everything to a single Empty, even a single object

  • ALWAYS apply all Scales and Rotations on every Transform throughout your hierarchy.

  • put as few objects in a given .blend file as possible, combining them in Unity into a prefab

  • REMOVE unnecessary items (Light, Camera, etc.)

  • use good names for your Blender3D objects and NEVER RENAME them after Unity sees them

  • don’t even think about final Materials or Textures in Blender. Set the mesh to use N different materials, unwrap your UVs, bake textures if you must (like for AO), but always set up the materials within Unity and disregard what gets imported.

Unity imports Blender3D objects as FBX via a little Python script:

The Python script that Unity uses (substitute your Unity version number or search) to import:

./Hub/Editor/2020.2.1f1/Unity.app/Contents/Tools/Unity-BlenderToFBX.py

More on fixing it:

Blender3D objects used as trees / detail in Unity3D terrain (See the second half of this response)

Probuilder and Probuilderize and Blender:

Some more potentially-useful info:

Updating Blender files without breaking your prefabs:

Costs of using Blender files directly vs exporting to FBX:

Hi Kurt,

Thanks for the answer.

I write a short answer for the moment because I’m on my phone:

My model was commissioned and it looks good on Unity except for the flag… Doesn’t that mean that it was properly unwrapped? I thought that unwrapping is a requirement in order to create a texture.

The only information I can give you for sure is that the artist painted the model with Substance Painter. I’ve never heard about this software bth.

And, you know, I may sound ignorant, but I have extremely limited experience with materials. How do I create material for a model like this? I assume, I must create a new material for the piece of the spaceship?

Regarding the UV test grid, could you please be more precise? Here, I also have limited experience. If I unwrap the model from scratch, then won’t textures look completely messed up in Blender?

In the end, a very practical question: how do developers and artists manage to work like this? My model is simple after all. I can’t believe that developers need to work these things out for each exported model. There must be a better way doing this.

I am not sure what you mean by that.

Everything you post above looks like fully-understandable fully-fixable issues.

Yes, sometimes those fixes must be done in a program outside of Unity, eg, in Blender.

Other times, setup has to be done properly in Unity.

The notes above are intended to guide you to a working understanding of the core systems involved in handling the data through the authoring pipeline to final use.

What generally will never work is doing something and expecting 100% of it to work on the first time. That has never been a thing and almost certainly will never be a thing in any context: making cars, building airplanes, designing surfboards, cooking a souffle, knitting a sweater, making a video game, etc.

This looks like the texture uses transparency, but the material is set to opaque, and all pixels of the texture are the same color, including the transparent area. In the material, set the Rendering Mode either to Cutout (Sharp edges) or Fade/Transparent (softer edges, but possible rendering issues when multiple transparent objects are overlapping).

Unfortunately*, Unity handles its materials somewhat differently than Blender when it comes to the textures it uses. Most notably, instead of roughness, it uses smoothness, which is the same, but inverted, so black and white/bright and dark are swapped. Every image editing software I know can do that. The other thing is that the standard materials don’t have a dedicated slot for smoothness. Instead, it can be either in the alpha channel of the base color/albedo, or the alpha channel of the Metallic map. This can be switched with the “Source” option below the Smoothness slider (which acts as a multiplier for the smoothness map, if there is one). This means the material uses one less texture, but not necessarily that less memory is used because with “Normal” compression, a texture with an alpha channel is twice as big as one without. However, the reason why it is like this is probably because compression is less lossy for the alpha channel and so the smoothness is more accurate. With “High Quality” compression though, the alpha channel is actually worse, but in this case there is no difference in size between a texture with and one without alpha channel, so you save memory by not having a separate smoothness texture. And it can be either in the albedo or in the metallic alpha because not every material needs a metallic map, so unless the alpha channel of the albedo is already used for transparency, you also need one less texture then.

As a side note, only the red channel of the metallic map is used for the metallic property, while only the green channel is used for height and occlusion, so if your material has one of those properties, you can put it in the green channel of the metallic map and use it in this slot as well (no property uses the blue channel because it has the worst compression quality).

In order to get the texture into the alpha channel you have to use an image editor that can do it, or an asset like Texture Channel Mixer | Utilities Tools | Unity Asset Store. Since you mentioned Substance painter, this can also export smoothness maps (but it’s called glossiness), and there is an export template for Unity (however, it’s for the Universal Render Pipeline, while you are using the built-In, though the textures work very similar), but I’ve recently found that when using this template, the smoothness map in the alpha channel will be too bright, resulting in objects being too shiny.

In your material you seem to have put the same base color and normal map in the secondary (detail) slots as well, this is probably an error. These slots are meant for separate textures that add (micro-)detail on top of the base textures to make them look more detailed than they really are by increasing the tiling on the detail maps over the base maps (so instead of one very high resolution texture you could use two smaller ones to get a similar amount of detail). However, this only works for materials that are uniform in that they only represent one type of material (metal, wood, stone…), since the detail maps are applied to the entire area of the material.

*It’s not so surprising given that materials in Blender and Unity are used with somewhat different intents. In Blender, the real-time view is meant as merely a preview for the actual render, so it doesn’t accurately represent what it should look like, and materials can become very complex and take a long time to render correctly. It also doesn’t matter as much how many textures are used, how big they are, or whether they are compressed (as long as you have enough memory for rendering). In Unity, however, real-time rendering is the default, and so the shaders are optimized for that, as are the textures. Because of this, it is not easily possible to port Blender materials to Unity, you always have to do some manual work.