Scene capture 2D, performance loss in editor vs. packaged

I’m using a simple scene capture 2D and a frame rate loss is expected. My issue is that I’m seeing a much higher FPS loss after packaging the project in comparison to using the scene capture in the editor. It’s something like a 10-ish FPS drop in the editor and a 40+ FPS drop when playing the packaged project.

I’m not sure where the extra performance loss is coming. Is there something extra happening with screen captures after being packaged, and can I get them to function closer to how they do in the editor?

I’m experiencing the exact same issue. I’m working on it now and will let you know if I find an answer. From what I’ve read elsewhere it seems that capturing and displaying dynamic shadows may be the culprit. Temporal AA also seemed to have caused screen flicker pre 4.13 in a packaged game when scene capture was displayed but that might not have an effect on framerate or be an issue if you are using 4.13+. I haven’t updated from 4.11 since that is what was current when I started making my game and I’m frankly afraid to update considering the issues that transferring a game in progress between updates can cause.

After messing with this all day, the only thing that I can do to stop the performance hit is to shut off my dynamic directional light source (moving sun) while the scene capture 2D is active. (I use it for an animated proxy character when I open my inventory).

Previously, my inventory UI and proxy character were overlayed so I could see the game environment and every thing that I normally see through my FP camera behind my inventory box and animated proxy character as normal. This works great when playing in editor and was nice because I could be sorting through my inventory and still see if an enemy was coming at me in the distance in the background, but having both the dynamic world with a moving sun and shadows and the proxy character scene capture simultaneously was causing too much lag in a packaged game.

In my case, the current fix was to turn off the sun, and quickly fade the camera to black when I open the inventory and automatically turn the sun back on and fade back to normal when I close the inventory. This keeps the frame rate steady and I see no drop what so ever.

However, my proxy character was lit by the world directional light (dynamic sun) but I simply added one to the Proxy character BP and made it only affect the proxy character (else it would have affected the game world like a second sun) by using the second light channel.

This works to get rid of the lag, but I rather liked being able to see the dynamic game world behind my inventory overlay instead of just a black background.

This may not be the fix for your case at all but it might give you an idea how to fix it. I believe that the main reason most people have this issue is related to the dynamic directional light in their level. (simply turning off cast shadows on everything did not work either, I had to literally deactivate the sun so it wasn’t shedding light by using a simple visibility boolean).

1 Like

Thanks for the info. I’ll mess around with turning off lighting/shadows.

Just wanted to add an update to this. Although my previous workaround did help, it was not without flaws and still caused issues in the packaged game. What I ended up doing was totally foregoing the capture 2D for my HUD proxy character.

Instead I have the proxy character very tiny and very close to the camera. When the inventory opens, the proxy character is made visible. This works like a dream and although it seems hacky, it’s a very simple and looks better than the capture 2D. I know this won’t work for every situation, but it is a very good workaround to adding an animated dynamic proxy character to a HUD in my situation. Trickiest part was getting the lighting right mostly because I used separate channels to light the proxy instead of the world and the bias has to be drastically different when dealing with something very tiny very close to the first person camera. Overall, the end result is much better than what I was getting trying to use the capture 2D, mostly because the resolution I get is better and the perspective angle looks better.

1 Like

We are seeing the exact same issue as described here in 4.20
We use a sceneCapture to create minimap of a very reduced, downscaled version of our city scene. When running in editor, the scenecapture has a cost of aprox. 0.5ms, so almost negligible…

In package however, the cost is almost 15 fps…which is huge and makes the project almost impossible to run…

Why is there such a huge difference?

1 Like

Update:
Only affects the package when run with attached oculus
Vive (or Vive Pro) doesn’t make any difference compared to editor runtime.
So issue UE-59090 is definitely not fixed in 4.20

Still not fixed as of 4.22… there’s some post saying “just do SceneRenderTargetResizeMethod to 2” bro but no such option exists, at least no exposed to blueprints…

While dealing with the same issue i managed to stumble on the following entry.

The fix on my end was to set the texture targets X and Y Size value to the HMD’s native resolution (3296x1776 for oculus rift S) and the problem dissappeared for me.

I can confirm same behaviour for 4.23.1

after setting RT size to 3296x1776 , everything is ok.

What is meant by everything is ok? Doesn’t this tank the performance even more by having it be such a large render texture? And if it does only tank it for PC but the the HMD what is going on behind the scenes to make it smaller?

What is meant by everything is ok? Doesn’t this tank the performance even more by having it be such a large render texture? And if it does only tank it for PC but the the HMD what is going on behind the scenes to make it smaller?

If someone its still trying to figure this out, I think I found the solution, this may or may not help everyone since capture 2D is used for many things, in my case Im just capturing the feet of my player from under the map resulting in a simple white and black image, so this means that I dont need to render anything else except the landscape and my character, which means that everything else being processed under the hood can be disabled.

So if you go to the blueprint where you 2D scene capture is, click on the 2D Scene capture, and then go to the details (still inside the blueprint), write on the search bar “Flags”.
There will be tons of checkboxes checked, start unchecking them, specially the shadow ones, dont leave any checked unless you REALLY NEED IT. This saved me 7.00 miliseconds to the GPU, went from 19ms to 12ms.

Hope it helps!

Ps: Some may know these already but I didnt, and these options were fairly hidden in the details so in case someone didnt find them, heres the tip!

1 Like