# How to measure frustum at a given distance from camera?

**URL:** <https://forums.unrealengine.com/t/how-to-measure-frustum-at-a-given-distance-from-camera/442581>\
**Category:** Rendering\
**Tags:** fov, scenecapturecomponen, scenecapture2d, unreal-engine, question\
**Created:** [February 2, 2019, 4:10am UTC](https://forums.unrealengine.com/t/how-to-measure-frustum-at-a-given-distance-from-camera/442581 "2019-02-02T04:10:02Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![Megadoom2oR](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Megadoom2oR](https://forums.unrealengine.com/u/Megadoom2oR)\
**Post date:** [June 12, 2021, 11:27pm UTC](https://forums.unrealengine.com/t/how-to-measure-frustum-at-a-given-distance-from-camera/442581/2 "2021-06-12T23:27:55Z")

</div>

Old question, but this is how I did it in blueprint. I’m sure this could be done basically the same way in C++, too.

I’ve broken my solution into macros to make the graph cleaner and easier to read, plus these are each useful macros on their own:

1. Get the Viewport bounds with a simple macro. All this does is get a set of Vector2D corner coordinates in screen-space.

 ![341345-get-viewport-bounds.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/b/c/0bc66f34a07425d37eda8f4a355570822733ae75.png)

1. Convert those viewport points into world space coordinates and use the direction vector to construct a line from the camera to some arbitrarily large distance.

 ![341347-get-frustum-edge-endpoint.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/7/b/3/7b35fec6773a92393aba9bfea6298f97179d9ab2.png)

1. Feed the camera position and an origin+normal plane in along with those frustum endpoints we just got to find the intersection of the plane with the `Line Plane Intersection (Origin & Normals)` node. I added optional debug draw functionality to this for visualization purposes (see final image).

 ![341348-get-frustum-world-corners.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/0/d/8/0d85f0828b4d3c0152a32a163e65622df4998215.png)

With those macros defined, wire it up like so:

 ![341349-whole-solution.png](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/5/c/d5ce99d28db18ece69a9d2b912ce608d1d8817ae.png)

And the resulting debug draw in-scene. Red is the line edges of the frustum, the orange dots are where they intersect the plane defined by my blueprint’s actor (a plane at the center of the frustum):

 ![341350-frustum-being-drawn-in-world-space.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/4/0/7/407945e2e30897e4c873dac88ee5f871c945ca1e.jpeg)

**Disclaimer: No guarantees this works in all situations, I’m pretty new to Viewports, but it did the job in my case. If anyone has a better way I’ll happily adjust and re-post the answer. Also, I’m doing this in UE5 Early Access, just because that’s where I was playing around. Should work the same in UE4.x, though.**

---

_[View the full topic](https://forums.unrealengine.com/t/how-to-measure-frustum-at-a-given-distance-from-camera/442581)._
