I have a problem with the Backface Culling option (in the texture tab) of the Game Engine.
I modelled a closed environment and textured it. As it’s closed, I only need to see the front (normal) faces and not the back ones so I kept the Backface Culling option activated on my textures.
Here is the problem : http://i.imgur.com/5aFNLgs.png
For example, you can see that some of the faces of a hall are hidden because of the Backface Culling Option, but the opposite ones are showing since their normals are in the direction of the camera.
How could I avoid that ?
Or … I don’t know … is there a way to hide those faces when I’m in a certain area by flipping their normals with some Python or something else ?
I don’t really want to decrease the camera view distance …
No, I think his problem is that you can see the inside walls while the camera is outside of the object. Which is something that just comes naturally to 3D level design. That’s why when you look at .map files for games like Ocarina of Time, you see little rooms positioned way off of the main map, teleporting the player there when they “enter a door” or “take an elevator”. This is so that other rooms and even skyboxes can hide those rooms.
You could manualy set the normal of each vertex of a mesh, though it might be a bit complex and may cause a bit of a performance dip (depending on how you implement it.) HERE is how you can set the normal of a vertex.
I’ve seen that kind of stuff happen in skyrim and counter-strike source, with counter-strike in particular you’ll notice that on some maps if you go into spectator mode there’s an entire background scene the developers made and they tucked it out of the map so that players can’t see it when they’re running around.
This kind of thing is why so many games use invisible walls and close off bits of the game with rubble because otherwise the player would either fall off the edge of the map or run into things like that, unfortunately you’ll have to come up with the same ideas in order to prevent players from running into this or get a nice background scene up for them to run into and take the hint.
I personally prefer proper walls and real obstacles to limit where I can go though most of the time, invisible walls do piss me off when they don’t make sense
Yeah, I agree. If your map is closed off but is supposed to mimic an open environment like a city or hillside, don’t just wall things off. Use mountain ranges or road blocks or car crashes to block off your map.
You always need to find a balance between what is to see and what is efficient to render.
If camera never sees the other side of a wall, there is no need to model this other side.
Typically a camera can’t see both sides of a wall at the same time, so you can remove the side that is not visible.
If you keep that in mind you can design your environment in an efficient way. If the camera is outside of the room (and can’t see inside, you can completely remove the inside. If the camera is inside the room, you can remove the outside.
The worst idea is to have a complete city with all the little details. This is not efficient and not necessary. Show what is need to be visible - avoid what is not necessary.
Also think about timing: What is the minimum time (from now) when to show a mesh? Typically this depends on distance and speed. Distance depends on the path, so it can be longer than the direct line. You can do a very fast estimate by grouping areas [better estimate too short than too long].
In the above case, it is very unlikely to see the interior within the next couple of frames -> remove the inside, add the outside.
So, in order to do that, I should separate a room into two meshes : the outside and the inside, and hide the part I don’t need, right ? (Is deleting then adding the part again more efficient than hiding/showing ?)