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
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.
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.
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.
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.
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.
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.
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: