Gaps between 3D objects. How do I get rid of them?
We're making a game with modular terrain. Not UnityTerrain or what's it's name, just small pieces made by a 3d modeller in Blender, from those pieces I build tiles in Unity Editor, and from those tiles the game then generates a road in runtime, procedurally (OK, mostly just randomly, but it's not the point).
The issue is when I connect the pieces in Unity Editor, there are gaps between them.
The models provided by the modeller are in a single .fbx file, with a material included. Textures, normal maps and others are in separate .png files (not sure if all of that is relevant, i'm pretty new at all that 3d graphics thing).
Modeller says, he does have a similar thing in Blender, when he tries to connect pieces there, but it's just an issue of fast in-editor Anti-Aliasing. After the model is rendered - he tried exporting a full tile from Blender - there are no gaps.
Also when I made prototype tiles in ProBuilder, there were no gaps.
I'm using ProGrids to align the pieces, but I also tried to do 'vertex snapping' (holding 'V' while moving the piece) - no difference.
What I tried (nothing helped):
- 'Playing' with textures (turning mip-map on/off, setting wrap mode to 'clamp', among other things) - I don't think it can help, because the gaps are there even when the albedo of the material is empty.
- Installing Post-processing stack and switching between Anti-Aliasing modes. Doing this just makes the edges more or less jaggy/blurred. This screenshot is from build, not from editor (in case there is a difference between rendering, like in Blender).
What is the cause of this, and how do I fix it?
P.S. Asked this in Unity Forums almost a week ago, still not a single answer or comment, so I'm posting it here as well.
Good day.
If you are doing the objects in blender, you must know all of them must to fit exatcly between them, i mean if a cube is 1x1x1 is breat but if is 1x1x0.099 you will comenece to have problems.
Unity have now the promesh ,that allows to modify meshes, but i dont know if you can do it with a external fbx.
Qorking with external fbx for map generation is ver"strict", you need to make them fit exactly, or will have this problems.
But... you dont want gaps for apperance, or they cause you some game problems?
Bye!
@tormentoarmagedoom Hello and thank you for the answer!
The modeller says they ARE exact fit, he double-checked it. In Blender, obviously. I can ask him to make them a tiny bit larger, but won’t that mess with their placement and snapping in Unity Editor? If they intersect with one another, won’t it cause flickering?
Also these are not cubes, they are what Unity calls ‘plane’, afaik, - completely flat. And the walls are hollow, they only have an outside surface. If you take the camera below the floor, and look up, most of this object will be invisible. I’m not proficient at 3D graphics, and it looks a bit weird to me, but this is probably how it’s usually done. Or is this the root of the whole problem?
Pro$$anonymous$$esh? The only similar thing I could find in asset store is something called ‘pro$$anonymous$$esh Combine Utility’, is that what you meant?
Gaps don't cause game problems, they are tiny, so they don't mess with navmesh generation at all. So this is purely for appearance - I don't want literal holes in my game XD
Good day Darg.
First i wanted to say PRoBuilder, not promesh ! (sry), and i see you know what it is.
The fact that they are planes and not solid object is irrelevant, they should work fine. IF there are gaps between them is because theyu are not the exatcly size you want. Are you sure the objects have exact sizes, and are not scaled?
$$anonymous$$aybe you can accurate the position to prevent that gaps, but as you said, if you overlap them, you will cause flickering.
The other solution (i dont know if is compatible with your project) Is to import from Blender a "one piece map" s no overlaping, no flickering.
The other option, as its only a visual problem, maybe you can cover the gap with some evoirmental element.
But I'm sorry I does not have a magic solution...!
Good luck! Bye!
Your answer
Follow this Question
Related Questions
Help! Why are all transform.position of parts of my model 0,0,0 ?! 2 Answers
Workflow for creating environments for Unity game 0 Answers
Share unity project with Autocad Plant 3D 0 Answers
Can I tile a material differently on different objects instead of making a new material? 0 Answers
Dynamic Scientific Data Driven 3D Models 0 Answers