What dimensions should you use for a perspective projection frustum? Initially I created a perspective matrix based on the width and height of the screen, with a calculated zNear value based on a 45degree FOV.
// OpenGL example // For height of 800, zNear is calculated to be ~965. zNear = (height / 2.0f) / tan(Deg2Rad(45.0f) / 2.0)); zFar = 100000.0f; glFrustum(-width / 2.0f, width / 2.0f, -height / 2.0f, height / 2.0f, zNear, zFar);
But then I realised that this isn't a sensible idea and you shouldn't base your frustum on pixels, and you should use logical units instead (else when the window / screen changes size, objects will change position or size).
So now I'm wondering what dimensions I should use for the logical planes of the frustum? How do you choose a zNear value? Is it sensible to base it on the desired FOV? I'm aware that having a small zNear value can mess with the z-buffer, which is why I initially based it on the FOV.
My current thoughts are of using a logical near plane of TopLeft: -10000, -10000 and BottomRight: 10000, 10000. But then that generates a zNear value of ~24142 based on 45degrees FOV, which seems awfully high. What advice do you have? What dimensions should you use for a projection frustum?