Forum rules - please read before posting.

Depth of Field & Cinemachine

Hello!

I'm somewhat new to AC and have been setting up a game where I'd like to integrate Cinemachine and use the latest Post processing stack. I set up a custom camera with the CM brain and everything seemed fine.

My main camera has a DOF setting that I wanted to alter on my Virtual Cameras.  I was attempting to use the PP script that passes the depth to the main camera on the Wikia but it's yielding errors about the Post Processing namespace.

A Google search yielded a discussion about namespace issues with v2.0 of the Post processing stack and it was suggested to move any scripts referencing the PP to the folders it resides in. However, with Unity 2018.2 and the package management system, I can no longer alter anything within the package folders it seems.

Any suggestions would be appreciated!

(I'm using Unity 2018.2.0f and the latest package additions of Cinemachine and Post Processing through the package manager.)


Comments

  • Welcome to the community, @FancyFerret.

    When you mention your main camera with the DOF setting, what exactly are you referring to?  The AC MainCamera?  The CM Brain?  There's a couple of approaches you can take to integrating CM with AC - what's your setup, exactly?

    I'm not totally clear if this issue relates to AC - if there's an issue with PP then it'll be for the Unity resources / Unity forums to get help from.

    What's the link for the discussion you're referring to?

    So far as AC's camera system goes, each GameCamera has their own DOF setting which is passed to the AC MainCamera when made active.  The MainCamera's DOF can then be retrieved through script with:

    AC.KickStarter.mainCamera.GetFocalDistance ();

    If you're relying on CM cameras instead, however, then that likely won't apply.
  • I have a global Post Processing volume (v2) that is set for my Main AC camera as below:



    Cinemachine will render any settings in a global PP volume as the deafult unless an override is attached to a particular virtual camera. So, for some virtual cameras I've made override volumes to change the DOF on a per-camera basis as seen below:

    image

    However, when using an override volume with just a different DOF than my main AC camera, I don't see any changes in the final DOF, even while adjusting the values in-game.

    I was also trying to use the script on the wikia to pass the DOF values but it's giving me namespace errors.

    Here's a mention about that: https://forum.unity.com/threads/using-unityengine-postprocessing-not-found.507651/ One of the suggestions is to move files but as I mentioned that's no longer possible due to the package management system it seems.

    There's previously conflicting info regarding the namespace issue, which is a Unity issue itself it sounds like: https://stackoverflow.com/questions/50400363/the-type-or-namespace-name-postprocessing-does-not-exis...

    However, right now I'm not even using Cinemachine and just trying to get standard  Game Cameras to pass their DOF but it seems I'm still not getting the effect passed to the AC Main Camera.

    For DOF to work should I go back to a v1 Post Processing profile so it will pass properly to the AC Main Camera?


  • Setting aside Cinemachine for the moment, then, a custom script is necessary to transfer DOF values from GameCameras to the MainCamera.  This is due to the multitude of ways they can be used - with multiple PostProcessing versions and DOF assets out there, a "one size fits all" approach is not feasible.

    What are your namespace errors exactly from the wiki script (this one, I'm assuming)?

    That script is written for v1 (see the asset store page it links to), so you will have to revert to PP1 to make use of it for the moment.  I shall look into the feasibility of updating it for v2 for you, but given the issues with Unity you've brought up, I can't guarantee it'll be possible right now.
  • Update: I've been through the wiki script and have added a variant for Post Processing Stack v2.  It won't work when imported as a package due to the error already mentioned, but should be OK when downloaded via the Github page.
  • Awesome! Thanks so very much for everything you do.

    I've had AC for a while but just now got around to making a substantial game with it and it's truly one of the top tier Unity assets. Amazing product for sure!
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.