Same material in 3ds max, but Seperated in Unity

I’m trying to import my BSP and in 3ds max all the materials are correct, with the same ID and same material.
But after I import it into Unity, there is a few versions of the same material and it seems to be separating itself.

I’ve tried re-applying the materials a couple times now and it seems to just change where it separates. I’m trying to cut down on draw calls and it isn’t working out so well.

Here is a picture. The green wall should be the same as the bricks, its doing it with a lot of other ones as well.

Edit: Ok I just realized it split the mesh into 4 parts. But it is totally in random places, anything I can do about it? Does that mean it made 4 times more draw calls then it would be with one mesh?

Thanks for reading.

I blurred out the names cause I’m going to be running a contest for who ever knows the real world place of the scene, if your wondering why.

Is it possible you are using a multi-subobject material in Max? Consider converting the material to just a standard material if this is so.

Doesn’t this happen when the model is too high poly to import into Unity?
What is the polygon count of the wall model?
If this is so - reduce polygons until it imports as one complete model. No reason for a wall to be high poly. :wink:

1 Like

Yes it is a multi-subobject, and I’ve tried single materials as well.

Its about 206 thousand faces, the wall is attached to everything else. Its a building with an interior.
On my older project when the wall was disconnected from the ground my AI shot through the walls, I guess I could use a sphere caster instead though.

Would the amount of vertex’s added be better then more draw calls?

Here’s a picture of the model, mind you its not even a quarter complete so the finished product will be just a little over 4 times bigger.

If I was working on this - I would look up best practices for level design in Unity. I would also not worry about draw calls until draw calls are a problem. However - I’m sure this isn’t a popular point of view.

I’m guessing there is a good reason most level design packs in the asset store are modular. Personally I would break up the level into modular pieces and assemble the level with these pieces in Unity. Share textures as much as you can and if desired there is a nice utility in the asset store called mesh combine or something. This helps reduce draw calls at run-time from the little research I’ve performed.

Walls should be roughly 10-20 polygons max - if they are like the walls you showed above. More detailed (sci-fi) walls can have more polygons, but I doubt most wall segments rarely go beyond 2k polygons ever. Probably more like 200 polygons is high for a game like this.

The AI running through the walls was not due to the walls not being attached to the floor. More likely there were misplaced coliders the AI went past.

I would apply a brand new standard material to the wall and recreate the wall texture in the material. And reset all the material IDs on the models. FBX does not retain sub-object materials and there should only be one material ID for the wall when imported into Unity, unless you are attempting some special effects with lighting and ambient occlusion.

1 Like

Sorry, I meant I use a multi-SubObject to texture the whole object not the wall (1 material for wall, 1 for floor and so on), it just allows me to select a number instead of applying the material every time. and yeah I have been sharing textures for as many places possible.

Also everything has a minimal amount of polygons, some rooms walls are literally 2 faces.
I’m guessing they make them modular for more customization, but I could be wrong. I know separating exterior buildings makes design a lot easier but it sounds kinda tricky with interiors.
I have a lot of assets planned for this building, and that’s why I’ve been worrying about draw calls, but yeah thanks I will try to look up best practices for Unity.

Sorry again, it wasn’t AI walking through walls, they were aiming and shooting their gun through the wall where it was separated, the ray cast literally found the tiny crack in the wall and was shooting the player through it.

Anyways, thank you for your input, much appreciated!

Edit: I removed the cells and made it into an object that I will place in Unity. It is easier getting it aligned then I thought, and it made the object into one piece again. So thanks again.

1 Like

Each material ID in Max ends up as a submesh in Unity, which is what the material array in Unity is actually matching to. However Unity’s internal meshes are limited to 65535 vertices per submesh, if it’s more than that I’ll have to split that material ID into two submeshes, appearing as two different entries in the material array. Also understand in real time graphics a single vertex can only hold one normal, UV, or vertex color, so hard edges or UV seams which would count as a single vertex in Max will be split up into multiple vertices depending on how many faces share it, so the vertex count can be several times higher than what you see in Max’s stats window.

My best guess is this is what you’re running into. That brick material is probably being used in enough places to hit that 65535 vertex limit, and Unity might not be too smart about where to do the split, just doing it on the first tri that pushes the vertex count over, rather than searching back through the mesh for a more “logical” split. In reality you probably want to split up this mesh into parts anyway. Doesn’t even necessarily need to modular. Unity’s occlusion culling system works on each submesh as a whole, and if any part of a submesh’s bounds (a box or sphere that surrounds the entire submesh) the entire submesh is drawn! For something like this building, standing at a corner looking out a window all 206k faces might be getting rendered still.

Check the editor’s console window. If it is doing this split due to hitting the vertex limit there’ll be a warning there.

1 Like

Thanks for explaining - what I meant - in a better to understand way. :wink:

1 Like

Thanks guys, appreciate the help!