OpenGL camera glitch

Hello,
I’m trying to setup a first person camera based on free camera class I wrote. It’s just basic camera class that you’d write if you were setting up free camera. I wanted to fix the Y coordinate (the up coordinate) at a certain value so you cannot go up and down without jumping or crouching. But I’ve come into a problem. I have certain scene and the walls in that scene are vanishing when I come to them too close. Something like this:

Any ideas to fix this ?

See Overview here for a diagram of what’s probably happening. Note the words “clipped”:

To fix, look at how you are setting up the near plane of your PROJECTION matrix. You probably want to reduce it so that this clip plane is closer to the eyepoint.

1 Like

Is that just near-plane clipping? Try reducing the near distance when setting up the projection matrix. But don’t set it any lower than it needs to be, as that reduces the accuracy of the depth buffer.

1 Like

Problem was indeed in projection matrix. Value of my near plan was 0.1f. I set it to 0.01f and it all works now just fine. Thx for advice.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.