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
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice
  4. Dismiss Notice

Making several cameras rendering different layers position identically

Discussion in 'Cinemachine' started by Ozego, Mar 13, 2020.

  1. Ozego

    Ozego

    Joined:
    Apr 26, 2015
    Posts:
    10
    I am trying to create some effects like dimming the background behind characters.

    In vanilla unity this is easy; at runtime just duplicate the main camera while the the effect is needed, split the original clearFlags amongst the original and the clone, add a blit to the OnRenderImage of the clone and move it back in draw depth. Having them position identically is just copying params in update. Once the effect is no longer needed the clone can be destroyed and the maincam's clearflags can be restored and performance is not impacted.
    However it seems that Cinemachine is controlled by cameras clearflags and doing shenannigans like this makes the vcam go into standby mode unless it is soloed.

    How do I make several cameras rendering different layers position identically?
     
  2. Ozego

    Ozego

    Joined:
    Apr 26, 2015
    Posts:
    10
    I figured it out, vcam needs to be in the layer (eg. Character) that is rendered by the mainCam (the one with the brain) and same technique works with cinemachine. Thanks.
     
    gaborkb, marc_tanenbaum and Gregoryl like this.