Search Unity

Cinemachine Automatically Setting Camera Far Clip Plane

Discussion in 'Cinemachine' started by funselektor, Mar 13, 2019.

  1. funselektor

    funselektor

    Joined:
    Oct 11, 2013
    Posts:
    105
    Been running into an issue where the Cinemachine Brain script is setting the Far Clip Plane of the camera to 5000.

    This seems like way too much and I'd like to have control over it. Is there any way to stop Cinemachine from doing this?
     
    larry2013z and BMRG14 like this.
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    Yes, set it here in your virtual camera:

    upload_2019-3-13_11-33-4.png
     
  3. funselektor

    funselektor

    Joined:
    Oct 11, 2013
    Posts:
    105
    Oops that makes sense, I forgot to check there.
    I really appreciate the quick reply!
     
  4. deadlycrow

    deadlycrow

    Joined:
    Feb 10, 2014
    Posts:
    166
    any way to change that in runtime? or to disable cinemachine overriding this parameter so i can control that from a custom script ?
     
  5. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    Your custom script can manipulate
    vcam.m_Lens.FarClipPlane
    . That value will be pushed every frame from the vcam to the Camera.
     
  6. zeropointblack

    zeropointblack

    Joined:
    Jun 8, 2020
    Posts:
    197
    im having the exact opposite problem.

    id like my virtual camera set at 5000, but it keeps reverting back to 1000 at runtime.

    my other virtual camera and freelook are fine...
     
  7. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    Sounds like the value is being set at runtime from some script somewhere. Can you check for that?
     
  8. zeropointblack

    zeropointblack

    Joined:
    Jun 8, 2020
    Posts:
    197
    yep. you were right. i gave it another look. it turns out i had a BOLT lens setting node buried in my Zoom code macro which defaulted at 1000.

    Thanks, Greg.
     
    Gregoryl likes this.
  9. ChristopheFernandez

    ChristopheFernandez

    Joined:
    Mar 21, 2022
    Posts:
    1
    Hi, I have a similar problem with a large scene. using the starter third person asset. If I add a CinemachineVirtualCamera to modify the camera's clipping plane, I must disable the CinemachineBrain. But the third person controller is then stuck in place. If I thick the CinemachineBrain back on, it moves again but with a clippingplane automatically blocked at 500 meters. What can I do ? Thanks in advance.
     
  10. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    Why must you disable the CinemachineBrain? Can you give more details about what you're trying to do?
     
  11. R2D2

    R2D2

    Joined:
    Nov 28, 2010
    Posts:
    7
    I'm using the First Person Core Template in Unity 2021. The camera far clipping plane is locked at 500. How do I change this value?
     
  12. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    Set it in the VirtualCamera, not in the main camera.
     
  13. R2D2

    R2D2

    Joined:
    Nov 28, 2010
    Posts:
    7
    Thank you very much Gregoryl!
     
  14. MattESqr

    MattESqr

    Joined:
    Feb 5, 2020
    Posts:
    15
    Is there a way we can just tell Cinemachine (at an application or Brain level) to not modify certain properties?

    We have a camera stacking setup and very particular and controlled setting of near/far planes, and it shouldn't be the content people (artists/designers/cutscene team) that need to remember to set (or update) every single VC. The VC should instead instead first defer to some 'authority' (Brain, or app wide CM settings) before changing such things.

    Is this possible?
     
  15. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,730
    For a complete answer you'll have to give me some more details about your needs, but off the top of my head you can hook into CinemachineCore.CameraUpdatedEvent, which is fired every frame just after the Brain has positioned the camera and set the lens. In the callback, you could restore any values that had been erroneously changed.
     
  16. MattESqr

    MattESqr

    Joined:
    Feb 5, 2020
    Posts:
    15
    Thanks for this, that does what I need for now, I'm able to set the output camera settings to what I need.


    For context, and due to our particular setup with cameras, it's not ideal that those authoring the artistic side of the camera's need to be aware of all the technical/performance related topics, such as very specific near/far settings. They should just focus on the creative side.

    Since there are far more VC's than the single Main camera, it's also not practical to manage this at a content level. Thus was hoping to be able to set project wide restrictions to what a VC is allowed to modify. This would allow content people to go on being creative and the tech/perf team to feel confident a VC isn't accidently breaking things. :)

    Cheers!
     
    Gregoryl likes this.
  17. Unifikation

    Unifikation

    Joined:
    Jan 4, 2023
    Posts:
    1,087
    The dirtiest way to do this is put an Animation Legacy component on an object in the hierarchy that's above all your CM cameras, and then set a keyframe at the beginning of animation clip that's the value you want, for each camera's property that you want. This overrides any and all other attempts by Unity systems to modify this parameter's value, and will "lock" the value in the Inspector, too, so user's can't accidentally modify it.

    Couple of steps that need to be taken:

    The clip to do this needs to be added as the default clip for the Animation Component, and placed at the top of the list of Animations in the Animation Component, though when doing this trick you'll likely only have the one clip in this list, but it still needs to be in the Default slot, too. Just in case.

    This is an ugly, tacky and hacky way to achieve this lock, but it works like a charm, for me, and provides a very easy place to edit these values, and to put lots more in this lock state in this single place. And swapping clips means swapping values. So is quite a powerful "preset" mechanism.

    And you can easily, for example, lock unique clipping plane values to each unique camera, as needed, and each will be in this list of modified/locked objects, in the Animation Clip, whereby it's as simple as clicking on the Animation Clip's name of this camera to select it in the hierarchy for further adjustment/assessment/creativity.
     
  18. ZenniverseCreate

    ZenniverseCreate

    Joined:
    Sep 5, 2021
    Posts:
    3
    7 years later and this solved my issue. Thank you!
     
  19. isteyak25428a

    isteyak25428a

    Joined:
    Apr 1, 2023
    Posts:
    1
    thank you so much brother