How to find visible tiles using a perspective projection?

Started by
12 comments, last by MarkS_ 11 years ago
Your issue I believe is that your doing soacahtoa with degrees and not radians.
Advertisement
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
I'm sorry. I feel like a tard. Anyways. X = (tan(fov/2)*height)*2
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.

This topic is closed to new replies.

Advertisement