How to find visible tiles using a perspective projection?
I am using degrees, but am converting to radians.
30° in radians = 0.5235
tan(0.5235) = 0.57735
5 / 0.57735 = 8.66025
8.66025 * 2 = 17.32050
30° in radians = 0.5235
tan(0.5235) = 0.57735
5 / 0.57735 = 8.66025
8.66025 * 2 = 17.32050
I was looking at my projection matrix and noticed that the location[0][0] was exactly 1/100 the correct projected tile width. Looking at glm::perspective, I came up with this:
range = tan(fov / 2) * z_near;
right = range * aspect;
left = -range * aspect;
width = ((2 * z_near) / (right - left)) * (z_far * z_near);
I would still like to know how to get the fov from the projected size.
range = tan(fov / 2) * z_near;
right = range * aspect;
left = -range * aspect;
width = ((2 * z_near) / (right - left)) * (z_far * z_near);
I would still like to know how to get the fov from the projected size.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement