OSM map to unity, split

Hi, I modeled a city in blender using Open street map data. I have only buildings (so cube, no steets or others), 27k vertex and 46k tris, in one big mesh (In this way I use only one big 4k texture, perfection is not needed but I need a lot of cities, one for each level/scene).
I need to develop a game in unity with these buildings, but when I export fbx file unity says:

Meshes may not have more than 65534 vertices or triangles at the moment. Mesh ‘82739575’ will be split into 2 parts: ‘82739575_MeshPart0’, ‘82739575_MeshPart1’.
UnityEditorInternal.InternalEditorUtility:ProjectWindowDrag(HierarchyProperty, Boolean)
UnityEditor.DockArea:OnGUI()

Which is the problem? I haven’t 65k vertex in blender, unity uses more tris?
How can I solve this issue?

Thanks

i don’t use Unity but polygon limiting seems dumb.

anyway, i think you might have more than one mesh in your blend file and blender exports everything into one FBX object.
be sure to check “Selected Objects” in the FBX export options and try again.

I already checked selected objects in FBX export options, I also try to import the .blend file in unity but there is the same issue. This is the outliner, it’s not complex, so anyone can help me?

Attachments


also make sure you dont have modifiers on your mesh. if you have a level 3 subdevision surface and it applies this during export then you have another problem.

I already check “selected objects”, uncheck animation and apply modifiers. I have only cubes, 1 for each building but it’s a map so there are a lot of cubes.
I have one mesh in unity only if I set “none” instead of “import”/“calcuate” in the import fbx menu in unity.
I’m not a ninja in CG, and I usually import models with all it’s needed (normals/materials).
So question 1: there is a way to import also normals without increase the number of vertex?

What happens without normals? (My idea of normals is vector of 90 degree that go inside or outside a face in the cube, so I think that are needed; for example to apply texture outside the cube and not inside, or for physic properties, or also to know if a face of the cube is visible or not. It’s a quick and stupid resume but it’s right?) If are needed, there is way to recalculate normals in unity?

In blender I already check “selected objects”, uncheck animation and apply modifiers. I have only cubes, 1 for each building but it’s a map so there are a lot of cubes.
In unity I have one mesh only if I set “none” instead of “import”/“calcuate” in the import fbx menu.
I’m not a ninja in CG, and I usually import models with all it’s needed (normals/materials).
So question 1: there is a way to import also normals without increase the number of vertex?

What happens without normals? (My idea of normals is vector of 90 degree that go inside or outside a face in the cube, so I think that are needed; for example to apply texture outside the cube and not inside, or for physic properties, or also to know if a face of the cube is visible or not. It’s a stupid resume but is it right?) If are needed, there is way to recalculate normals in unity? (calculate in fbx import menu also cause the split of the mesh)

join them all together as a single object, save it. rename it. open a new blendscene, click file, append, click the blendfile you just saved, navigate to objects, and select the object you just renamed. then try from there. this way you kinda reset all the settings.

also just in case, go into edit mode, press T to get up the tools panel, scroll down, and click remove doubles.

“when I export fbx…”

Is there anything special in your osm map? Why obj file format is not good enough?
Here is a 26k verts osm map converted to obj. Try if this works for you.
http://wikisend.com/download/301360/OSM_test.zip

My OSM map consists only in buildings: I extruded the square, so my model consist in a lot of simple cube. All the cubes are 1 single object. In this way with a big texture I have a decent and fast model of a city. I need a lot of cities, one for each scene in unity, and the programming part is more important at now. So I think this is the simplest and most efficient way for this.

In blender
26303vertex 17582faces 45858tris

In unity with fbx and Normals: calculate
Mesh1:65532vertex 39260 tris uv
Mesh2:12864vertex 6836tris uv

In unity with obj and Normals: calculate
Mesh1:65532vertex 37504tris
Mesh2:13216vertex 8354tris

So FBX seems more efficient.

The problem is inside unity, and I know this is a blender forum(sorry), but at the beginning I though the problem is the export.
Maybe Someone had already solved this problem.
In any case is a unity problem, If I import normals unity has 3*(vertex blender) dues to the fact that when exporting meshes from Blender any two adjacent faces that have their normal blending set to hard. The vertex is split between those 2 polygons. If the normal are set to smooth then these 2 faces continue to share the same vert.

With smooth shading (and not flat) the unity mesh is only 1 with

57395vertex 45858tris (in any case 2*(blender vertex) and in this case I don’t know why)
But in unity import menu I set import normals (If I set calculate the buildings became flat but I still have 2 mesh )
Other suggests?

@finalbarrage The trick don’t work because the problem is in unity and not in blender!

Thanks

You’re absolutely right - flat shading increases vertex count. If that’s what Unity does i doubt there is an easy way around.
Doubled numbers look like double sided mesh is used; for a simple cube that would double face (and vertex) count. See here.

Can you see imported mesh in Unity in the end ? One more thing to check with your mesh are normals. Your problem reminds me this one which was caused by normals pointing in wrong direction. I’m not sure if this is the case, at least try to select all in Edit mode and use Recalculate Normals operator via Ctrl + N.

ideasman42 says: “Blender draws double-sided by default” - post is edited on May 31, 2015.

Is this still valid?

I already recalculate Normals (and merge double vertex). Anyway thanks for the suggests.

larvantholos says in your link: “In your game engine, or in your 3d app if you turn it on as an optimization, back face culling helps optimize how the mesh is drawn on the screen. So, you didn’t import a 2 sided mesh, you just imported a 1 sided open faced mesh, and if you want it to have 2 sides, you need to duplicate and flip it”

And also this interesting article says that by default are single side and not double sided
http://www.katsbits.com/tutorials/blender/double-sided-faces-different-materials.php

Maybe unity convert single side in double side? I tried to check “backface culling” that :“Only show the front side of faces. Use this to find faces flipped the wrong way, especially when exporting to programs that use single sided drawing”. Because this seems now the issue for unity vertex=2*(blender vertex) but it doesn’t work. It seems that backface culling is only for the view in blender, and it doesn’t interest unity.

Hey you do know about osm2world. converts osm data into .obj files with building height data, might be quicker depending on cleanup vs building height manually. Just an idea.

I don’t use unity, but… try on blenders side smooth shading, exporting fbx with tangent space and face smoothing options selected, and in unity import and don’t recalculate normals.
(this changes .fbx vert count on a cube in unreal from 24 to 8, .obj cube imports as 8 vert standard)

I think flat shading assigns 3 verts per corner standard, so a cube will end up with 24, but smooth shading dependent on normal and smooth edges/faces data can be all sorts ie 8,23,24,36.

you can use blender4web addon or yavne https://github.com/fedackb/yavne to alter normal direction to achieve the results in the linked discussion for more complex meshes.

in depth explanation:
http://polycount.com/discussion/154664/a-short-explanation-about-custom-vertex-normals-tutorial/p1

Ok for smooth shading (even if buildings are more realistic with flat)! During the fbx export what is the difference between face smoothing or normal smoothing?

In any case is ok, but I cannot check tangent space because return this error:

why?

Thanks for all the support!

Attachments


Error message you get give explanation on the last line: …only for tris/quads. Your mesh has ngons or stray faces/edges somewhere.

Face smoothing I think renders the face smooth(flat) as apposed to a rounded corner, so essentially you get flat shading without the overhead? this is where beveled or chamfered edges with custom normals aligned to large faces comes in, this is not for your situation but more complex meshes,

convert ngons to tris, as the game engine will be using tris anyway.

I would tend to divide the city mesh into smaller groups, say 2 groups per city to get around vert limits in unity, I really don’t know how unity deals with draw calls, mesh lods, material draw calls etc, and depending on you game type: flight sim vs FPS shooter for example smaller (area wise) objects may be better, or not. (does unity redraw entire mesh per material in view etc, could be trade-offs for extreme large meshes) I can’t answer any of the above sry.

It’s late but Thanks for all the help. Solved.