- Home /
how can i make this house not invisible from the inside?
so when i import my house into unity i looks fine from the outside but when i walk in it i can see through everything. i want to not be able to do this in the game. i want to be able to walk up to the house and open the door and walk around the house. i know that as a poly it only renders one side of it and i just found this out. so i dont want to start the house all over. is there any way to fix this? im using 3ds max
http://i1303.photobucket.com/albums/ag156/nova00971/inside_zps9915789e.jpg this is the inside view
Answer by Adamcbrz · Aug 19, 2013 at 04:12 AM
There is two options you can do.
1) find a shader that doesn't has cull both. Here is a forum post that might help, http://forum.unity3d.com/threads/136231-mobile-2-sided-diffuse-shader?p=924526&viewfull=1#post924526
2) return to 3d max duplicate the polys and reverse the normals.
well since im still new to the whole scripting thing and only know how to write one to turn the flashlight on and off i went with choice 2 since that seemed easier. i was able to make cuts and extrude those cuts to make a wall and reversed the normal and seems to work fine now! thanks! :)
Don't use Answer unless you are actually answering. Use comment. And if this is the correct answer, please mark it answered by clicking on the checkmark
Ups.. didn't noticed you answer right first Adamcbrz. I guess I was slow typing :)
Answer by DaveA · Aug 19, 2013 at 05:15 AM
You can use this script. Put it in a js file in an Editor folder under Assets:
@MenuItem("GameObject/Flip Mesh", false, 4)
static function FlipMesh()
{
Undo.RegisterSceneUndo ("Flip Mesh");
var trs = Selection.GetTransforms (SelectionMode.Deep);
for (var tr in trs)
{
var r : MeshFilter = tr.gameObject.GetComponent.<MeshFilter>();
if (r)
{
var m : Mesh = r.sharedMesh;
if (m)
{
var tris : int[] = m.triangles;
for (var i : int = 0; i< tris.Length; i+= 3)
{
var t : int = tris[i];
tris[i] = tris[i+1];
tris[i+1] = t;
}
m.triangles = tris;
}
}
}
}
@MenuItem("GameObject/Double-side Mesh", false, 4)
static function DoubleSideMesh()
{
Undo.RegisterSceneUndo ("Double-side Mesh");
var trs = Selection.GetTransforms (SelectionMode.Deep);
for (var tr in trs)
{
var r : MeshFilter = tr.gameObject.GetComponent.<MeshFilter>();
if (r)
{
var m : Mesh = r.sharedMesh;
if (m)
{
var tris : int[] = m.triangles;
var tris2 : int[] = new int[tris.Length*2];
for (var i : int = 0; i< tris.Length; i++)
tris2[i] = tris[i];
for (i = 0; i< tris.Length; i+=3)
{
tris2[i+tris.Length] = tris[i+1];
tris2[i+tris.Length+1] = tris[i];
tris2[i+tris.Length+2] = tris[i+2];
}
m.triangles = tris2;
}
}
}
}
Answer by CodeAssembler · Aug 19, 2013 at 04:18 AM
Unfortunately no. If you want to fix that you then have to use a custom shader or something that renders 'double sided' on purpose instead of just 'reacting' to the polygon normals like Unity render usually does.
So if you don't use such a custom shader, then the only option would be to 'fix' the normals in 3ds max (in your case) and make sure you do use a Cube mesh instead of a plane so it can have normals both sides or just duplicate the plane and flip it and use on plane per side with the normal facing 'to the camera'.
Here is a link for a discussion on the subject of the double side shader:
http://answers.unity3d.com/questions/187630/writing-a-double-sided-shader-how-to-reverse-the-n.html
I hope this helps
Answer by meat5000 · Aug 19, 2013 at 06:50 PM
In 3DS, make it a solid object with separate inner walls to outer walls. The normals will work automatically. In blender you can do this through an operation 'solidify', don't know about 3DS, might require some work but less than implementing shaders if you are well versed in modelling.
Your answer
Follow this Question
Related Questions
Adding a new mesh to a prefab from it's blend file 0 Answers
Can't import assets 7 Answers
Common ingame 3D Model import for players 0 Answers