# Can Scene Capture 2D render only part of the viewport?

**URL:** <https://forums.unrealengine.com/t/can-scene-capture-2d-render-only-part-of-the-viewport/367579>\
**Category:** Rendering\
**Tags:** Optimization, portal, Scene-Capture, unreal-engine, Rendering, question\
**Created:** [August 19, 2016, 6:02am UTC](https://forums.unrealengine.com/t/can-scene-capture-2d-render-only-part-of-the-viewport/367579 "2016-08-19T06:02:18Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![fireapache](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@fireapache](https://forums.unrealengine.com/u/fireapache)\
**Post date:** [August 19, 2016, 6:02am UTC](https://forums.unrealengine.com/t/can-scene-capture-2d-render-only-part-of-the-viewport/367579/1 "2016-08-19T06:02:18Z")

</div>

Hi, I’m implementing a portal effect and I’m using scene capture 2D in order to generate the portal’s destination: [https://youtu.be/6QCgtk4MpJ8](https://youtu.be/6QCgtk4MpJ8)

I’m concern about rendering optimization where the problem is that the portal may be far way, but the scene capture component will always be rendering the entire screen to the render target texture…

Is there any way I can specify only part of the viewport to be rendered by the scene capture component? Maybe using rectangle coordinates (x1,y1,x2,y2) so the scene capture will not render things that are outside the portal bounds and therefore will be discarted.

Thanks!

---

<div class="post-metadata">

**Author:** ![Mookaroni](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Mookaroni](https://forums.unrealengine.com/u/Mookaroni)\
**Post date:** [August 28, 2016, 9:59pm UTC](https://forums.unrealengine.com/t/can-scene-capture-2d-render-only-part-of-the-viewport/367579/2 "2016-08-28T21:59:35Z")

</div>

I think what you’re looking for is the max view distance on the Scene Capture 2D.

On a side note, I’m curious on how you lined up the portal’s views relative to your character’s position if you’re willing to explain

---

<div class="post-metadata">

**Author:** ![fireapache](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@fireapache](https://forums.unrealengine.com/u/fireapache)\
**Post date:** [August 28, 2016, 11:17pm UTC](https://forums.unrealengine.com/t/can-scene-capture-2d-render-only-part-of-the-viewport/367579/3 "2016-08-28T23:17:27Z")

</div>

It’s not view distance… I hope the attached image will make my point.

About the positioning, there’s no mystery about it, each portal just take the relative transform of the player from it and apply it to the target portal rotating by 180º around it root component.

 ![104721-portal.jpg](https://d3kjluh73b9h9o.cloudfront.net/original/4X/b/4/6/b4646030bf0a6a486c0efd5c8e570244822b04df.jpeg)

---

<div class="post-metadata">

**Author:** ![dillzilla](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@dillzilla](https://forums.unrealengine.com/u/dillzilla)\
**Post date:** [May 3, 2017, 12:39am UTC](https://forums.unrealengine.com/t/can-scene-capture-2d-render-only-part-of-the-viewport/367579/4 "2017-05-03T00:39:53Z")

</div>

im having an issue with rotating the capture components. no matter what rotation i give them they stay the same.

---

<div class="post-metadata">

**Author:** ![LeFxPete](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@LeFxPete](https://forums.unrealengine.com/u/LeFxPete)\
**Post date:** [June 7, 2017, 1:36pm UTC](https://forums.unrealengine.com/t/can-scene-capture-2d-render-only-part-of-the-viewport/367579/5 "2017-06-07T13:36:19Z")

</div>

I think your attached image does not show, how your Scene Capture Component in this view actually works. If I understand your setup correctly, your SCC should be attached to your portal itself, so it will actually capture “through the eyes” of the target portal, and not through your eyes, like in your image. However, you’re right, that there is a lot of overhead due to the relatively small screen size of your portal compared to the capture size behind it.

If you somehow want to optimize your screen component capture efficiency, playing with your _render targets resolution_ might improve results. I don’t think, that you can tell your Scene Capture Component to somehow “do not capture” specific parts of your scene, at least I’m not familiar with a way to do that. 😕 Especially since you would have to adjust this area each time your player moves and it’s view angle changes.

---

<div class="post-metadata">

**Author:** ![fireapache](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@fireapache](https://forums.unrealengine.com/u/fireapache)\
**Post date:** [June 7, 2017, 2:32pm UTC](https://forums.unrealengine.com/t/can-scene-capture-2d-render-only-part-of-the-viewport/367579/6 "2017-06-07T14:32:10Z")

</div>

I don’t think there is an option to render only part of the viewport, but I would be happy with any direction on what to change in the engine in order make that feature… or even a “it’s not possible” from any UE4 staff would be good too. 😛

---

<div class="post-metadata">

**Author:** ![RobertPotter](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RobertPotter](https://forums.unrealengine.com/u/RobertPotter)\
**Post date:** [August 30, 2021, 1:34pm UTC](https://forums.unrealengine.com/t/can-scene-capture-2d-render-only-part-of-the-viewport/367579/7 "2021-08-30T13:34:10Z")

</div>

Hey, resurrecting this post 5 years later!  
Did you ever find out a solution or even a alternative to this problem? I’m struggling to get my portals more performative at the moment and thought the very same thing might work.

---

<div class="post-metadata">

**Author:** ![fireapache](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@fireapache](https://forums.unrealengine.com/u/fireapache)\
**Post date:** [August 30, 2021, 1:37pm UTC](https://forums.unrealengine.com/t/can-scene-capture-2d-render-only-part-of-the-viewport/367579/8 "2021-08-30T13:37:15Z")

</div>

Unfortunately not, I left this project behind, I hope you find the solution for it!

---

<div class="post-metadata">

**Author:** ![RobertPotter](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@RobertPotter](https://forums.unrealengine.com/u/RobertPotter)\
**Post date:** [August 30, 2021, 1:45pm UTC](https://forums.unrealengine.com/t/can-scene-capture-2d-render-only-part-of-the-viewport/367579/9 "2021-08-30T13:45:22Z")

</div>

That’s a shame, thanks for the swift reply though!

---

<div class="post-metadata">

**Author:** ![msteffen](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@msteffen](https://forums.unrealengine.com/u/msteffen)\
**Post date:** [August 3, 2024, 5:54am UTC](https://forums.unrealengine.com/t/can-scene-capture-2d-render-only-part-of-the-viewport/367579/10 "2024-08-03T05:54:11Z")

</div>

I figured out a way to do this. You can control how much of the viewport is rendered by changing the Field of View of the Scene Capture Camera.  
 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/b/c/2bc2f0aab625c57c16fb30a22b1499356e0413b9.png)

However, this normally causes the view to be zoomed in. You can adjust for this (basically undo the zoom) by scaling your texture coordinates in the material. Here’s the formula for scaling your texture coordinates based on the field of view angle (FOV) of your scene capture camera:

tan(captureCameraFOV/2) / tan(playerCameraFOV/2)

This gives you the scale factor that you need to apply to the scene capture image in order to remove the zoom effect.

Here’s what my blueprint looks like that calculates the scale factor:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/2/0/220efc131bbab71f79549544736d74f85cd567ae.png)

To apply this to your texture’s UV coordinates, you actually need to invert this though…

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/a/a/7/aa700f64a4dfc5c27d5ffd3cfa5957246f77eea5.png)

Lastly, I apply this scale factor to the UVs in my material:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/7/1/2715901032759d0cf285a97920c9d888a3dd24a2.png)

It works well, and gave me a few more frames-per-second.

Another tip is to make sure the scene you’re capturing is optimized. I gained an additional 5 fps by removing unneeded dynamic lights!
