Search Unity

Cinemachine not affect Main Camera?

Discussion in 'Cinemachine' started by cursedtoast, Nov 20, 2021.

  1. cursedtoast

    cursedtoast

    Joined:
    Apr 27, 2018
    Posts:
    62
    I have a VR project and I'm trying to achieve the player being able to watch footage on a TV screen in the room. The TV screen is a render texture. So two camera's in total - the player camera, part of the XR Rig, and the "TV Camera" which has the cinemachine brain and outputs to a render texture.

    The virtual cameras pan around the room and should output to my render texture. This should not affect my VR rig's camera, ideally.

    However, as soon as I take the camera (not associated with my XR rig) and output to a render texture, the cinemachine brain wants to use my players XR main camera.

    Is there a way to force the cinemachine brain to use a separate camera so I can achieve what I need to achieve?
     
  2. gaborkb

    gaborkb

    Unity Technologies

    Joined:
    Nov 7, 2019
    Posts:
    856
    CinemachineBrain should control the GameObject it is attached to. So it should not affect your XR main camera. Could you share some screenshots of your setup (e.g. both your main camera's inspectors)?

    Currently not, but it is going to be supported in a later release.
     
    cursedtoast likes this.
  3. cursedtoast

    cursedtoast

    Joined:
    Apr 27, 2018
    Posts:
    62
    Perhaps poor wording on my part. The Cinemachine brain affects the camera tagged MainCamera, which belongs to my XR rig. I created a separate camera (untagged) for the Cinemachine brain/sequence. However, at runtime, the sequence uses the XR main camera. I'm guessing it's impossible right now based on what you said though.

    I'm basically trying to create "spectate" cutscenes, similar to RE4 VR, in which the player watches the cutscenes on a camera render texture plane, if that makes sense. I'll keep an eye out for a Cinemachine update in the future, I suppose, or cut the functionality for this project.
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    By default, when you create the first CM camera in your scene, the CM UX will create a CinemachineBrain and attach it to the Main Camera. That's probably what happened to you. Just move the CinemachineBrain component from the XR camera and attach it to your other camera instead. The CMBrain will control the object it's attached to. It does not pay attention to camera tags.
     
    Baaartosz and cursedtoast like this.
  5. cursedtoast

    cursedtoast

    Joined:
    Apr 27, 2018
    Posts:
    62
    Thanks, apparently that was the problem. I appreciate the help.
    One last question! I'm using the Storyboard extension to do a camera fade. However, this fade effect doesn't seem to work when outputting to a render texture (everything works okay on the output texture, except for the storyboard). Is there any work around for that/suggestions? I guess with this particular setup, I could place a canvas over my render texture and trigger the fade-to-black that way, but I wasn't sure if there was something I was missing or if it's just an incompatibility.

    Thanks again!
     
  6. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,724
    If you're only using Storyboard for the fade-out, I would instead recommend some other approach, such as the one you suggested.
     
    cursedtoast likes this.