x


Capturing the real-time output of multiple cameras in a scene

If there are 20 cameras in a scene and I need to capture the outputs of those cameras with different resolutions at least 15 fps. What would the best solution?

In other words, if I have a powerful enough machine, can Unity render multiple outputs at the same time? What are the constrains?

Preferably I don't want to split my screen and show the camera outputs next to each other and get the camera outputs, because in that case I am limiting my self to the screen size.

The other way, would be capturing each output in one frame, for example, if the scene is rendered 150 fps. I can get 10 cameras' output, each in a frame.

But all the mentioned solutions are not applicable for me. I even don't need to display the outputs. as far as I can store the outputs in the memory or file, it solves my problem.

more ▼

asked May 29 '12 at 03:37 AM

PedramAUS gravatar image

PedramAUS
202 1 2 4

(comments are locked)
10|3000 characters needed characters left

1 answer: sort voted first

Prepare:

  1. Assign RenderTargets to each camera
  2. Set desired resolution on each render target

Then in each frame do a loop through all cameras and perform this:

  1. Set render target active (or camera active?)
  2. Create new texture the same size as render target. This will tell next step which camera is should read.
  3. Do Texture2D.ReadPixels. This steps copies pixes from render target to the texture
  4. Optional: Texture2D.EncodeToPNG and then write them to disk, but this will slow down things a lot.

In general capturing one camera to disk is a slow thing, so capturing many will be a problem. Capturing to memory might be better, but you will fill your memory fast, unless your resolutions are small.

more ▼

answered May 29 '12 at 08:20 AM

Paulius Liekis gravatar image

Paulius Liekis
7.3k 16 24 47

(comments are locked)
10|3000 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Topics:

x3130
x355
x304
x34
x16

asked: May 29 '12 at 03:37 AM

Seen: 940 times

Last Updated: May 29 '12 at 08:20 AM