Teardown

Teardown

CCTV Script & Showcase
YuLun  [developer] 29 Aug, 2022 @ 6:22am
Output Images
General discussion about capturing and outputting image function for camera.
This function IS NOT added to script
< >
Showing 1-6 of 6 comments
YuLun  [developer] 29 Aug, 2022 @ 6:45am 
It's obvious that capturing images is highly performance consuming, but you might ask why output quality can be affected. I'd like to carry out a simple calculation to make you have a better understanding about this.

Say we want a output of 72p, which is 1% resolution of a 720p video u can get on YouTube.

72p is 128 pixels by 72 pixels, we need at least one raycast for each pixel on this output image, so in total we need 72*128=9216 raycasts to draw a image at 72p

9000+ raycast in one tick time is obviously not practical, so let's limits that to 10 raycast per tick, which means 9216 raycast would take 922 ticks to finish.

Assume tick time is 1/60 second (60 Hz standard frequency for Teardown to run), so 922 tick would take around 15 seconds to finish.

It might seems ok, because some CCTV footage have a similar refresh rate (you can easily find some on YouTube), but please notice that this is the time to capture a whole picture, which is more similar to exposure duration. So this actually means you would receive a picture looks more like a long exposure photo, but still very different.

Remember I said these 9000+ raycast spread among the 15 second period? This means that there would be a time difference between different pixels as well. For example: the 1st pixel and the 11th pixel would have a 1/60 second gap between, 0.5 second gap for the 301st pixel, and 1 second gap for the 601st pixel. This would give you a very weird looking picture especially when an object is moving while got captured.

Therefore, if you want performance, you get very poor output graphic; if you want graphic, performance is terrible. You can't get both at the same time
eclipse 31 Aug, 2022 @ 9:43am 
seems... logical.
Laqota 15 Nov, 2022 @ 9:52pm 
Quite literally taking a Roblox 2015 CCTV approach by teleporting the player/camera to the security camera is probably the best possibility for optimization. It won't even need raycasting!
YuLun  [developer] 16 Nov, 2022 @ 2:07am 
I know what you mean, but I won't consider that method to be "outputting". That's more like "viewing" to me.
Dragon152123 13 May, 2023 @ 4:35pm 
You could SetCameraTransform for one frame to capture an image, then display it on a monitor somewhere. Think that'd work?
YuLun  [developer] 13 May, 2023 @ 5:38pm 
I already thought about that a month ago, but problems are when you have more than 1 camera, you need to ensure only one is taking pictures at that frame. Another problem for that method is it would take up spaces on your computer slowly and there's no way to delete any of them using modding API (for security). It would also make player's view to flash periodically which is not what I want.
< >
Showing 1-6 of 6 comments
Per page: 1530 50