Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Question [Solved] Animating a focus pull using URP built-in Post Processing

Discussion in 'Cinemachine' started by alexroflol, May 9, 2020.

  1. alexroflol

    alexroflol

    Joined:
    Apr 18, 2018
    Posts:
    16
    I'm trying to animate a focus pull during a camera move but having a bit of trouble. I read this thread but, from what I understood of it (I am very new to Unity!), this solution requires me to add a Cinemachine Post Processing extension to the camera.

    I tried this, but my problem is that it doesn't seem to accept profiles created using the built-in post-processing of the URP. I would rather not go back and create a new profile with this (older?) method as I have just managed to set up my desired effects in the URP.

    Sorry if I'm missing something obvious - as I said, I'm quite new to this. Any advice would be greatly welcome, thank you!
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    Instead of the CinemachinePostProcessing extension, use a CinemachineVolumeSettings extension. That works with the builtin URP post processing.
     
  3. alexroflol

    alexroflol

    Joined:
    Apr 18, 2018
    Posts:
    16
    Thanks for the advice! I am now able to use my desired profile, but the ability to directly access the depth of field is still unavailable, unless I'm missing something? The volume settings gives me a bool to focus on the target and an offset float.
     
  4. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    That's what you have to work with. The profile is an asset, so should not be animated. To animate the focus distance, set the bool and animate the offset in the CM VolumeSettings extension.
     
    Liderangel likes this.
  5. alexroflol

    alexroflol

    Joined:
    Apr 18, 2018
    Posts:
    16
    Thankyou, I've just tried this and it has worked!
     
    Gregoryl likes this.
  6. Danielsantalla

    Danielsantalla

    Joined:
    Jan 7, 2015
    Posts:
    75
    @Gregoryl Why it shouldn't be animated? I'm trying to make an animation that includes post processing tricks and not being able to animate the effects with the animation timeline as I use to with the cinemachine post processing extension, is trapping me in a corner :/
     
  7. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658
    @Danielsantalla In general animating assets is considered bad practice because, by definition they are shared resources and considered constant data. There is no 'driven property' support for them as well, so animating them will make them change and dirty which is terrible for teams using source control.

    What CM does under the hood with focus distance is to copy the profile asset into a temporary in-memory profile and animate that. You could do something similar in a custom script to animate the PostProcessing effects.

    Alternatively (and perhaps better) you can use PostProcessing volume blending. Create multiple vcams with different PostProcessing profiles on them. When you blend between the vcams, the associated profiles (and their effects) will blend along with them. That might be enough to accomplish what you need.
     
    Danielsantalla likes this.
  8. Danielsantalla

    Danielsantalla

    Joined:
    Jan 7, 2015
    Posts:
    75
    Thanks, I actually needed to do some camera effects (like when you receive damage and the screen goes all red) and I accomplished to do that using several global volumes and animating the weight of each one. It seems to work fine except for one thing.

    In the screenshot you can see that the weapon is not being rendered correctly. Actually, the gun is being rendered in a separate renderer feature after the Post Processing. If I render the gun before the Post Procesing it works just fine, but after the PP it looks like this. It is worth mentioning that it only glitches like that when I press play.

    I'm thinking this might be a bug but IDK.

    I'm in Unity 2019.3.4f1 URP using URP/Lit materials.

    Any suggestions? @Gregoryl
    upload_2020-6-13_15-32-17.png
     
  9. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,658