I got no response on my previous thread but this is an issue that needs sorting out.
Here’s a new scene in Unity using a plane and a cube to demonstrate.
You can see there’s a gap in the shadows cast by single-sided objects, such as the plane (or in my previous post, corridor walls which are only ever seen from the inside).
I can’t find a way to get rid of this effect, beyond giving the objects depth - i.e adding faces to the sides and back - faces that will never be seen (and which also block the internal view of my corridors in the editor).
There should be no visible light getting through two intersecting objects, but in the above image you can see the plane doesn’t cast a correct shadow - it’s got a gap of light at the point where it intersects the floor.
If you want the shadow algorithm to give you correct results, your geometry needs to be two sided. Either the small edge or two sided geometry. There is no alternative as far as I know.
The walls in my scene are not flat planes but have side edges - it’s just the back faces are missing.
If I add back faces I will not be able to see inside the structure I am building in the editor easily - the corridor (below) will be obscured by geometry which is never seen by the player and which has no real purpose.
I think this is an issue Unity should look into - that one-sided or partial geometry should be able to cast shadows correctly would help to make more efficient and more easily viewable levels.
Hello, I have the same damn problem with the shadow rendering -.-
The lighting really needs to be redone.
The solution can’t be that I have to make EVERY wall/ceiling of a model with 200 planes two-sided.
I simply have modelled a cube and reversed the sides. That cube is supposed to be a complete dark room in the scene. Its one single mesh and the edges have no gaps or something but the inside does receive this really annoying bit of light in the edges! Is there any way to fix that?
Hi. Its impossible to have one way faces cast shadows correctly. Unity is very very very handicapped in the light and shadows department.
You would either have to
inverse extrude the faces of the cube and then cap the borders in your 3d program
add scaled quads in Unity to cover up the edges (like in my screenshot) and make them invisible inside the editor using a custom layer
I know it sucks, but that’s the way it is. It sucks. I only haven’t switched to Unreal Engine at the moment, because it is very very very slow when importing any asset and I don’t want to use Visual Studio with C++.
Here the cover the inverted edges with quads example:
The directional light comes from the world X axis and would cause light bleeding inside the staircase.
Hmm ok, that is actually pretty bad! I am looking into the UnityLabs Project and the level design workflow is actually the same I use. From outside you have to be able to look through the inversed faces for easy access to the interior! I guess its the proper way of design levels and saves a lot of unused geometry, which ofc will increase performance load! Unfortunately this project doesnt have any directional lights …
The Idea of inversing faces and extrude is not working either. I just copied the cube made it a bit bigger and inversed faces. I combined the two meshes and exported it to unity. As you can see in my second picture, the light is still bleeding with a Bias of 0.01! That’s not how it is supposed to be, the light is not behaving like we know from a real environment. So I hope Unity is going to address this and hand out a solution for this!
The only way it works is I create 6 cubes and form it as a room, where they overlap each other and even then it seems that light is coming into the room
I was still writing my reply when you posted your second comment. ^^
Yes! Only having faces that are visible to the player is commonly used in high quality games for performance reasons, a perk of that is the easy editor accessabilty like you said
The 6 cubes apporach is the only thing I found works, but don’t have them overlapped, floor, walls, ceiling as cubes like you would normally, align them to look good. (overlapping might result in ugly overlapping ingame).
Here is how I do it, I divide the floor and ceiling (they are actually the same .fbx) into 3 parts, Top face 4 side faces, bottom face.
Now in Untiy I can assign a material to the side I want to be visible to the player. The others simply have shadows only checked in the MeshRenderer:
They overlap here because its the ceiling mesh and the overlapping is not visible anyways.
Also I could have removed the mesh collider but I forgot about that.
Hope this helps you cope with Unity’s crap light engine.
You can still select the shadows only mesh but also easily access anything behind it.