Newbie with "3D environment" question
Hello again forum...
Finished coding a "simple" 3D environment in which a "player" walks around a room with a doorway to the outside world - basically a very simple first-person simulator.
I use "glfrustum" to add perspective, and set the clip planes to be 0.3 and 20 (near and far).
Everything is working well but I can't seem to solve the effect of near-plane clipping, i.e.:
1. When the player walks up to a wall and turns around (Yaw) then the wall pivots exactly at the player position and when end-on (player at 90 degrees facing along the wall) then the display shows both sides of the wall, i.e. outside the room as well as inside.
2. When the player walks through a doorway, near planes are clipped and removed, so the display shows a sort of cut-through version of the room walls either side of the door before the disappear behind the player for good.
3. Other objects in the room appear "cut through" as the player walks up to them and they are clipped.
These two effects obviously don't plague commercial releases of software.
Are there any tricks and tips anyone could provide me to solve the near-plane issues?
If I change the near plane for something larger than 0.3 then walls disappear even if I walk the player straight up to them (square-on) as if they have passed behind the player.
If I change the near plane for something smaller, the perspective effect is too pronounced - I get a very stretched view of the "room".
I could stop the player earlier and not allow them too close to a wall, etc. but this seems like cheating and would restrict player movement.
I'm trying to think what early software like "Doom" does when the player is up against a wall and turns around - does the program just blank everything not in the room to provide a "dull grey" wall cut-through section?
Tags for this Thread