Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Multiple Cameras at the same time (6-8) - perf and optimizations

Discussion in 'Editor & General Support' started by bgnt44, Jun 28, 2020.

  1. bgnt44

    bgnt44

    Joined:
    Jun 19, 2020
    Posts:
    2
    Hello
    Quick intro im using unity 2019.4, computer is windows 10, ryzen 3800x + RTX 2070
    and i would rather use HDRP but im open to other suggestions ..


    Im gonna try to be quick and simple. i dont plan to use unity to create a game, but i want to do some "basic projection mapping" ...
    Basically i want to project on 7-8 projectors a same scene from pretty much every angle (FOV 90degrees horizontal * 4 + 2 * top and 1or2 * bottom).

    (im not in any way professional in that field , the hardware is desktop computer + 4 small computers able to decode NDI stream and projection on vga or hdmi projectors of various resolution / brands ) So the whole projet is pure hobbyist and no commercial consideration at any point )

    For now, the workflow look like this :

    Unity (Scene and animation)
    -> X Cameras (under same game object for animation tracking purpose and pretty much all at the same coordinate each frame) filming a different angle (+/- matching projector position)
    -> X render textures (1280*720)
    -> X empty object Spout senders (to send the texture data)
    >>> Resolume Arena (Spout input)
    > applying some mapping (points displacement / rotation / scale / contrast / color correction) to fit projectors positions
    -> X NDI Sender (1280*720 )
    -> X projectors

    So the questions parts :
    1. Each added camera cut the fps by +/- half ( so if i have 200 fps with main camera i end up quickly at 20-30)
    guess its logic because the scene is render as many times as cameras (as shown in the frame analysis).
    SO First and main question : Is there any way to optimize that ?

    Im not speaking of global scene optimization to increase the initial fps, i ve played with baked lighting, different hdrp volume profile, lowering texture quality adding TAA or not , adding occlusion culling or not , changing the occluded plate value even to a minimal and to be honest that doesn't change much anything (+/- 5 fps) (i think lots of parameters / shaders are very well optimized for latest gen graphics cards, very impressive)

    But maybe there s a way to render things more globally and cutting part of the render to texures .. i dont know what im talking about but some guess

    2. Im not very happy with using Resolume between Unity and the projectors (not because of the software but it seems that the GPU is losing some power during the process and i see frame drop , lag and latency in the final presentation (it seems Desktop GPU dont like multitasking between software),

    Side question : Spout works better inside unity than inside the built executable (better fps) although the global fps double in the final executable so is there any priority applied to render tasks if they are displayed on screen ?

    So if it was possible, I would rather use the NDI plugin directly from Unity but im gonna have to do some transform on the render textures and i would like that to be efficient
    - contrast / luminosity
    - applying a deform matrix (because im not projecting into a dome but in a room and projectors are not 1:1 wall )

    Is there any proper workflow to apply a transform matrix to transform / deform a rendertexture ?

    And any efficient function to do that (not pixel iteration).

    Thanks very much for your reading and im open to all suggestions
     
    Last edited: Jun 28, 2020
  2. PraetorBlue

    PraetorBlue

    Joined:
    Dec 13, 2012
    Posts:
    7,735
    What's the use case for the multiple camera views? Does it have to be in realtime? Can the animation be prerendered? Are all the projectors visible at once?
     
  3. bgnt44

    bgnt44

    Joined:
    Jun 19, 2020
    Posts:
    2
    What's the use case for the multiple camera views? Each video-projector source come from a camera
    Does it have to be in realtime? Ideally yes, i would like to implement some interactive behaviour later
    Can the animation be prerendered? well i would rather have it realtime for the same reasons
    Are all the projectors visible at once? yes

    I was looking again at the Perfomance analysis graph, and i wonder, is there any way to render in parallels, as far as i understand a rendering must be single threaded but when its 8 rendering ...?

    Or maybe having a second computer and rendering half camera view on each, but is there any way to synchronize at a frame level ?
     
    Last edited: Jun 28, 2020