Download

CCTV Scene Capture 2D Performance drop

Hi

I am in the process of creating a CCTV system for my game. That players can look at this system in a room and interact with (hitting buttons to change/cycle monitors to different cameras).
So far, after a few hours the prototype is functional, I have 8 small monitors, 1 main monitor, each of which can have the camera changed (granted, it has a limitation where 2 monitors can’t display the same thing, however a remedy is in the works for that).

My set up is that I have 2 blueprints, a monitor blueprint, and a surveillance camera blueprint.

The surveillance camera has a Scene Capture 2D Component inside of it, not to be confused with a standard Scene Capture 2D object placed inside of a level. Even though they both do the same thing, the Scene Capture 2D Component does not have any “Show Flags”, it only has the post processing menu to customize.

Capture source on the Scene Capture 2D Component is set to “Final Color(LDR with PostProcess)”, and I disable things such as reflections, bloom, and anything that could slow down performance massively.
I know that when I just used a Scene Capture 2D object inside of the level and I turn off dynamic shadowing, it improves performance dramatically, to the point where the impact on performance is not noticeable, even with multiple cameras. However this is a pretty major aesthetic to discard.

My scene capture render target’s are only 128x128, I have also tried 512x512 but noticed next to nothing in terms of performance difference.
I have turned off HDR on the scene capture render targets too.
As far as the rest of the Render Target properties, I’m not entirely sure what else I should/could change that would impact performance.

I haven’t looked into it too much, but I am presuming that a Scene Capture 2D class would be updating the capture every tick? Which means the camera feed would be updating very frequently, thus slowing performance. So I tried to work out a way to limit the update rate.

I tried a bunch of different methods, timer’s, time-line’s even, but I found the best method was this:
c24c840d066c29a04829fcd75e298bddc119a900.png

This gives me the best performance in terms of frame rate, but when all 9 camera’s are going at once, the game has unbearable stuttering due to the turning on and off of the frame capture. My guess is the stutter is due to the frequent fluctuation of frame rate (66-71).

I am honestly not really too sure what I can do to make it so this surveillance system runs smoothly.

Does anybody have any thoughts or suggestions. And if I have not been clear on anything, please tell me so that I can elaborate.

I’m not sure if this will be of any use for you, but when I use a Delay for multiple objects instead of an Event Thick and I don’t want that awful stuttering I make the delay duration random using Random Float In Range. That way every camera in this case will be making its capture at a slightly different moment.

Again, this could be of not use for you, particularly considering that you are using very small numbers. I use it when I need to get information every now and then and may use a delay between one and two or three seconds for example, but with very small numbers I don’t know if will work.

You can try it anyway because will be pretty easy and there is no need to make any complex change to your Blueprint: you just need to add a Random Float In Range node and connect it to the Delay node and try different values to see what happens.

Hope that helps.

Thank you for the response, and for jogging my memory on another idea I wanted to try.

I presume that the stuttering is because it is updating all 9 camera’s at once on that particular tick or frame, so there is a large frame rate fluctuation, as opposed to lots of very minor fluctuations.

Thank you again. I feel that there are still optimizations to be made, especially because I would love to make it so my camera’s are nice and smooth (it’s a space age game…so surely camera technology wouldn’t be low frame rate :P), so if anybody has any suggestions to improve performance, that’d be great. I think the stuttering issue is pretty well resolved :slight_smile:

Just as an update, if I change the delay float in range from 0.01 to 0.02, then my FPS drops from about 88fps down to 40, where as if I leave it at 0.1-0.2, frame rate drops from 88 to 85…perhaps I need to tweak the values further to find a nice balance of performance and visuals on this one.

So I wanted to update this to give people an idea of what I did for optimization.

At the moment I just have a collision volume on the monitors. When a player enters the volume, it tries to do a line trace from player to the monitor every 1sec. If the line trace hits the monitor, then get the monitor to update the camera that is currently feeding to it to a faster frame rate. If the player leaves the monitor collision volume, then stop any further updates on that collision feed.

It’s really only a very basic optimization for the time being, and ideally, I would much prefer to make the frame rate change, based on the player’s camera frustum, and distance, but I’m honestly not too sure how to do a check like that.

In the long run though, if I can’t work out how to do a frustum check, or visibility check, the monitors will only be accessible in a security room anyway. The security room will have it’s own volume which will tell the camera’s to change their update rate.

Anybody got any suggestions?