Search Unity

Sub Camera with Post Effects conflicts with Game Camera (BUG?)

Discussion in 'Timeline' started by Oneironaught, May 22, 2017.

  1. Oneironaught

    Oneironaught

    Joined:
    Mar 10, 2017
    Posts:
    15
    Greetings-

    I'm experiencing an issue with setting up a virtual camera to have post-effects inherited from a sub-camera as per the documentation (this is in conjunction with Cinema Director). I'm hoping i'm missing something and it's just a matter of setting things up correctly.

    The issue i'm having is that when i place a "real" camera (a unity camera with post effects on it) and make it a child of the virtual camera which I want to inherit the post effects, it conflicts with the Main Camera (which has a Main Camera tag on it) at runtime. The conflict is that it causes the Main Camera to turn off (since it sees this other camera and only allows one camera to be active, thus turning off the main one), which causes the other shots using that main camera to not render and display the "no cameras rendering" text in Game view. IF I turn off the post effects camera, it is ignored and no post-effects are inherited. When using Cinema Director with the standard camera shots, they are enabled and disabled depending if they are currently active in the timeline.. this is not happening with the nested virtual post-effects camera.

    So my question is, how do I get the nested post-effects camera NOT to conflict with the Main Camera? Also, is the expected behavior that it ONLY inherits the post effects OR that it uses the actual nested camera? It appears the latter is true.

    here's the repro steps:

    Create a Main Camera with Main Camera Tag (if one isn't already in scene)
    Using Cinema Director create two CinemachineShots
    Reference shot one to "Virtual Camera A"
    Reference shot two to "Virtual Camera B"
    Create a new camera and add a post-effect to it (image effect\color adjustment\grayscale)
    Make post-effect camera a child of "Virtual Camera B"
    Hit Play in editor and notice GameView does not render and displays "no cameras rendering"
    Note Main Camera is turned off in Hierarchy

    thanks.. hope this made sense.
     
    Last edited: May 23, 2017
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    2,841
    The documentation is a little out of date, unfortunately. We are working on a n updated version. Here is the New Way:

    You need to have only one active Unity camera in the scene. For Cinemachine to control the PostProcessing effects, there is a special adapter behaviour that you have to use, as follows:
    1. Create a Main Camera, virtual camera A, and virtual camera B, as usual.
    2. On the Main Camera, add a normal PostProcessing behaviour, but leave the asset blank.
    3. On the Main Camera, add a CinemachinePostFX behaviour. You can leave its asset blank, or put a PostProcessing asset there to serve as the default when the active vcam has no PostFX of its own. The PostFX behaviour serves a liaison between Cinemachine and PostProcessing.
    4. On vcams A and/or B, add a CinemachinePostFX behaviour, and set the assets to what you want them to be.
    One way to think of it is this: the vcams are not cameras, they are camera controllers. They serve to control the main camera, and have no cameras of their own, ever.
     
  3. Oneironaught

    Oneironaught

    Joined:
    Mar 10, 2017
    Posts:
    15

    Thank you for the reply and instruction: I failed to mention that i'm running Unity 5.5.0 with the lastest Cimemachine from the Asset Store. I found the the pre-release Post Processing Stack package and imported that, however I'm not finding a CinemachinePostFX behavior anywhere, is this a 5.6 feature rolled in with the Unity 5.6 native Cinemachine? Can I get this workflow to work in 5.5?

    thanks!!!!
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    2,841
    You need to use Cinemachine 2.0 for this feature. Have a look at this post:
    https://forum.unity3d.com/threads/cinemachine-v2-0-release-candidate.470509/

    Although it says you need Unity 2017.1, I can tell you (unofficially) that it will work with 5.5, provided that you are careful NOT to import the "Cinemachine/Timeline" asset. If you do import that by mistake, you will get a bunch of errors in the log. In that case, just delete the Cinemachine/Timeline asset.
     
  5. Oneironaught

    Oneironaught

    Joined:
    Mar 10, 2017
    Posts:
    15
    Excellent! Will do... thanks :)
     
  6. Oneironaught

    Oneironaught

    Joined:
    Mar 10, 2017
    Posts:
    15
    one last shot, so importing WITHOUT the Cinemachine/Timeline still throws a slew of compile errors with the scripts in the Runtime directories... is there a more selective import to try :) ?
     
  7. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    2,841
    What errors are you getting? Can you show me the log?
     
  8. Oneironaught

    Oneironaught

    Joined:
    Mar 10, 2017
    Posts:
    15
    Gladly, but before I re-import the package let me make sure i'm EXCLUDING the right assets.. here's a snapshot of my import:
    upload_2017-5-25_10-17-36.png
     
  9. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    2,841
    Looks like you imported 2.0 on top of an earlier edition of CM. Try first to delete the Cinemachine asset from your project, then do a fresh import CM 2.0 (excluding timeline).
     
  10. Oneironaught

    Oneironaught

    Joined:
    Mar 10, 2017
    Posts:
    15
    Ahh.. i see. In doing so, is there a potential to break existing cutscenes/rigs that are already set up using CM?
     
  11. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    2,841
    Yes, they will all break, unfortunately. You'll have to recreate all your vcams. That's the bad news. The good news is that you get a ton of new features, and the promise that we won't break it again. We had to break it this time, for the worthwhile reason that we moved from a closed DLL-based implementation to an open-source one.
     
  12. Oneironaught

    Oneironaught

    Joined:
    Mar 10, 2017
    Posts:
    15
    ok.. i'm going in... first set of compile errors as follows
    upload_2017-5-25_15-12-9.png
     
  13. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    2,841
    Those lines are relying on a newer version of Unity than the one you have. Their purpose is to display the screen guide correctly in the editor when the camera is not filling the whole screen. If you don't want to upgrade, you can get away in this case by just commenting them out.
     
  14. Oneironaught

    Oneironaught

    Joined:
    Mar 10, 2017
    Posts:
    15
    Greetings again!

    Thanks for your help, i've managed to get it running and am in the process of replacing my cameras and overall everything seems kosher with one exception... as i'm working with Cinema Director the Cinemachine Shot no longer recognizes the new Virtual Cameras. It appears the old ones were prefabs and the new ones aren't. I searched for the issue on the forum but came up empty. If you can guide me past this, i think I will be good on my own from here on out... so one last time.. HEEEEEELLLLLP :D

    thanks!
     
  15. Oneironaught

    Oneironaught

    Joined:
    Mar 10, 2017
    Posts:
    15
    PS creating a prefab out of the Virtual Cam doesn't do the trick either, so it must be something other than that.. i'm hoping I haven't found a chink in the armor :(
     
  16. Oneironaught

    Oneironaught

    Joined:
    Mar 10, 2017
    Posts:
    15
    I suppose I could just add the cameras as actor groups and enable/disable them....

    Welp, unless you know of a fix for the "Cinemachine Shot Track" issue, I may have spammed my way to a solution with this thread ;)
     
  17. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    2,841
    I'm not sure what you mean when you say "Cinemachine Shot no longer recognizes the new Virtual Cameras".

    If you are using Timeline, then you will need the CM/Timeline integration module (which we said earlier in the thread NOT to import). Looks like you need it after all. As the timeline API has changed recently and you are using an older version of unity, you'll have to import the legacy Timeline PI. There is an embedded package included with CM/Timeline that supports the legacy API. Try installing it and see how it goes.

    PS don't forget to first delete any older CM/Timeline integration stuff.
     
  18. Oneironaught

    Oneironaught

    Joined:
    Mar 10, 2017
    Posts:
    15
    What I meant was that I'm using Cinema Director from the Asset Store and after going to CM2.0 the Cinemamachine Shot inputs in the Shot Track no longer allow me to hook up a Virtual Camera, it simply won't let me select or drag one into the "Target Camera*" slot.
    Having said that, I did import JUST the legacy API package and imported that (no other timeline assets were installed prior) and that resulted in a spew of errors: upload_2017-6-6_17-6-54.png

    For the most part, adding the CM Virtualcams to the Cinema Director as Actors has worked but of course the Fade/transitions don't work with those Actors (Global Tracks).. I wish we did move to 2017, but that move is above my pay grade ;) Hopefully we will in the near future, but for now... this is it.

    Also, unfortunately the Game Camera Guides don't render either, which I presume was due to commenting out the initial lines that were throwing out errors as per #12 in this thread.
     
  19. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    2,841
    Sorry for the mixup, I had forgotten that you weren't using a timeline-enabled Unity. You can't use the CM/Timeline integration after all. I'm not too familiar with Cinema Director. Did they have a Cinemachine integration that allowed you to use CM 1.0 with it? If adding the vcams as Actors works, then you should run with that.
     
  20. Oneironaught

    Oneironaught

    Joined:
    Mar 10, 2017
    Posts:
    15
    Not worries, I'm sure there's enough to keep straight just with going to 2017. Yes, Cinema Director has Cinemachine CinemaDirector Integration as part of their package. I'll hobble along until our studio puts on their big boy pants and moves to 2017. Thanks again for your support.
     
  21. Adam_Myhill

    Adam_Myhill

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    327
    @Oneironaught , Cinema Director needs to be updated to support CM v2.0. I know Dan and Adrian at Cinema Suite and will let him know about this, thanks for the heads up. Hopefully they get a fix in soon, I bet it's incredibly trivial to update on their end.
     
  22. Oneironaught

    Oneironaught

    Joined:
    Mar 10, 2017
    Posts:
    15
    Hi Adam, thanks for your response and offer to contact Dan and Adrian at Cinema Suite. I was wondering if you were able to get around to speaking with them. If indeed it turns out that it is a trivial fix for them, I would be very interested in communicating with them to perhaps get a patch. We're a bit stuck with some of the Director features not working because of it. Would you be willing to make an introduction? I'd be happy to pass you my contact information.
     
  23. Adam_Myhill

    Adam_Myhill

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    327
    Hi @Oneironaught - Dan responded "I will have the guys squeeze this in on Monday."

    PM me your email so I can intro you two.
     
  24. CSSupport

    CSSupport

    Joined:
    Dec 9, 2014
    Posts:
    6
    Hey @Oneironaught and @Adam_Myhill,

    Squeezed in this update for you, the CinemachineShot should now accept any of Cinemachine's virtual cameras. If you installed the old integration package you may want to delete those files first just to be safe.
     

    Attached Files:

    Adam_Myhill likes this.
  25. Oneironaught

    Oneironaught

    Joined:
    Mar 10, 2017
    Posts:
    15
    Excellent Adam, much appreciated! Everything seems golden :)
     
  26. Adam_Myhill

    Adam_Myhill

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    327
    Amazing! Great job on the fast turnaround. Much appreciated.
     
    Oneironaught likes this.
  27. Oneironaught

    Oneironaught

    Joined:
    Mar 10, 2017
    Posts:
    15
    Yes, thanks to ALL of you for the great support!