Sign in to follow this  

how can I get the furthest x, y z postins seeable

This topic is 4869 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi, I know how to get the frustum (projection matrix by model matrix). So from this, suppose I'm at position x,y,z and I'm facing in a direction theta (where 0 degrees theta is facing directly down the -ve z axis) - how can I find the minx and max, minz and maxz points in the world that I can actually see in the frustum ? cheers

Share this post


Link to post
Share on other sites
you have:

aspect ratio=width/height, probably 1.333333333...
fovy=45 or something like that.



nearpl. far plane
| _-|
| _- |
| _-fov |
|<------| ---> camera direction
| ^- |
| ^- |
| ^-|



so, to get the maximal height multiply the farplane distance by the sin of the fov (sin(45)=0.70710678118654752440084436210485 ... sin(45)*100.0f (or some other far plane distance) = 70.7106781186547524400844362104.

Now, i don't know for sure if its rectangular like in the nice picture i drawed or if it means the total distance, not just the straightforward distance (hmm hard to explain).

If it's rectangular the right top point will be (sin(45*aspectratio)*farplanedist),70.710....

Anyway this is probably not the correct way but i'm not that far off. Just messing around with things like sin(45)*aspectratio instead of sin(45*aspectratio) will more than likely result in the right combination, a bit onorthodox i must admit but this trying works for me, also to understand things better.

Share this post


Link to post
Share on other sites

This topic is 4869 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this