Sign in to follow this  

Make a Perfect Plane to Fit Frustum

Recommended Posts

So, I can definitely figure this math out but I was looking to see if there is a quick trick anyone can think of to make a plane fit exactly into the camera's frustum.

IE if I have a camera at (0,0,-10) and a view port that is 1:1 or even 1:1.5 ratio what size would a plane need to be to cover the whole viewport...  (I know I know simple math), I was hoping for a quick method if anyone has one though, no rush its not anything I actively need but would be useful for a side projects I am doing.

Basically what ShaderToy is doing.

Ill prolly just use this

Share this post

Link to post
Share on other sites

well, assuming that d is the distance from the camera to your plane, fov the camera fov angle and y the plane half height (and assuming that the frustum cam.minZ is still 1), then

y = d * tan(fov / 2)

and if x the half the plane width

x = y * camera.aspectRatio

if I remember well

Share this post

Link to post
Share on other sites
18 hours ago, Pryme8 said:

@JCPalmer is that to get the aspectRatio?  That's what I am assuming but was wondering about your input.

No simpler than that.  From a lack of math standpoint, I win!!!  I did switch to asking engine for the width, but no fov, tangent() calls, & my camera distance must only be less than the max z

Share this post

Link to post
Share on other sites

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  

  • Recently Browsing   0 members

    No registered users viewing this page.