- Home /
Blender to Unity glitch?
So, I was modeling a city in blender. I made the ground(Grass, street, sidewalk, etc) worked just fine. No problems.(Using the same process, model, UVSmartPrpject, save blend, export .fbx, export UV, then import the textures to unity and apply textures to the mats). Well this time, i am having a strange glitch to where if I look through the door, or window I will see clear through the walls from inside the building. But if i walk around to the other side, it solid and rendering the walls? What might the issue here be?
Here are example photo's of the issue i am speaking of.
Check your normals. Looks like the normals of the interior faces of the wall are pointing in the wrong direction (i.e. outward), resulting in the faces being culled.
Hey Josh, I just answered your question with a couple of (maybe to you) valuable bits of info when using Blender with Unity. take care bud. Gruffy
Answer by Gruffy · Mar 21, 2014 at 09:51 AM
Unity only supports single sided meshes (meaning a texture will show up on one side and be culled on the other)** **Sorry this above is wrong on my part and Unity does indeed support the removal of back face culling, check out @whydoidoit s comment below. He is correct and if you only wish to see the same texture on the inside you should add the shader code to your project and then change your current model material to use it.*** Gruffy Basically, you may have to duplicate your mesh with normals reversed in Blender (UV Editing mode-> Select all objects you want to have for inside areas and on the left hand panel of the right hand side window, you should see a tab that says"Flip Direction" and "Recalculate") You should press flip direction, then recalculate, then export. The place your original model and your flipped version together (maybe having to shrink by a tiny amount the interior version to make it fit inside with artifact-ing) The other way is to build both walls into a single model inside blender and separate out the uv
s (doing the flip directions & recalculations on the mesh faces inside the building) This would be like placing two planes together, ensuring their normals are both facing outwards, to make a wall and texture both sides separately, but as a model in Unity treating it as one)
Overall, this later option (correctly model both inside and outside through blender and export a correct UV mutliple texture set (inside and outside normals set to corresponding mesh faces))
BTW, Unity import double the amount of verts on every model to create the normals for the model (this is handy to know as it would point out that just duplicating the model and flipping normals, as indicated in first suggestion would increase your model vert count threefold) Do the latter suggestion as this will ultimately produce a more effective model for Unity to use. Take care and any questions where I can, I will help with. Here is a Youtube link, to your initial problem anyway. Blender to Unity Gruffy Edit: here is another handy tip... in blender, when in the model window, press the "N" key and find the "Display" tab. In there, scroll down until you find the "Backface Culling" checkbox. Check that, you will now see what Unity sees when creating your models. To prove this, once checked, go to your model and select all ("A" on keyboard), the look on left panel for Normals: Flip Direction and Recalculate - proceed with both, lookk at your model it should now look inside out. reverse flip dir and recalc to return the other way.
Step by step from the beginning: Open Blender new file. Select the cube in "Object mode", press "tab" to go to "Edit mode". Press keyboard key "A" to select all. press "N" keyboard key to get mesh control panel up. look down panel until you find "BackFace Culling" (found under "Mesh Display" tab). Check "backface culling" checkbox. Go to Mesh Tools panel and find "Normals" tab, click "Flip Direction". Click "Recaculate (just to be sure). Look at your Cube Now! Reverse last two steps to return normals to outer faces. ope that little tip helps, it changed my workflow in minutes knowing this. Take Care Gruffy
Unity only supports single sided meshes (meaning a texture will show up on one side and be culled on the other)
This isn't true. The default shaders mostly only support front faces but it is simple to create ones that also draw inside faces.
This would do it:
Shader "Custom/TwoSide" {
Properties {
_$$anonymous$$ainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader {
Tags { "RenderType"="Opaque" }
Cull Off
LOD 200
CGPROGRA$$anonymous$$
#pragma surface surf Lambert
sampler2D _$$anonymous$$ainTex;
struct Input {
float2 uv_$$anonymous$$ainTex;
};
void surf(Input IN, inout SurfaceOutput o) {
half4 c = tex2D(_$$anonymous$$ainTex, IN.uv_$$anonymous$$ainTex);
o.Albedo = c.rgb;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}
ah yes,didnt even think about "Cull Off". I will edit my answer and comment on that bit about not being capable of handling it (stupid comment - my bad).
Answer by MrScrumbles001 · Mar 21, 2014 at 10:25 AM
Your texture will only draw on the face with the normals facing out. If you want to be able to see inside the building you will have to use the solidify modifier in blender on the object so that it has an outward facing normal on the inside also.
Answer by JoshMBeyer · Mar 21, 2014 at 02:21 PM
I used the Solidify modifier on the walls that were not rendering, and now everything is rendering properly. Thanks for the help