Sign in to follow this  
Pryme8

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.

*EDIT*
Ill prolly just use this https://docs.unity3d.com/Manual/FrustumSizeAtDistance.html

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

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.