Keyframing post process FX values with Timeline

Hi all,

Is there a way to use an Animation Track (or any track) in Timeline to keyframe the individual values of a specific post process FX, such as the Depth of Field effect’s Focus Distance or Aperture?

Although there are threads and videos about this area they seem to all be discussing the deprecated scripts, before Cinemachine Post Processing became an Extension. It’s a little confusing.

Adam Myhill mentions in a comment on this video (

) that it is possible to keyframe everything, rather than blending entire cameras together to achieve the same result. Can someone explain how?

Thanks very much.

1 Like

You can use timeline to keyframe settings on GameObject. However, the PostProcessing Profile is an asset - meant to be shared by multiple game objects. Think of them as static settings. You can’t animate those, but you can blend between them.

That said, Cinemachine does provide a special “Focus Tracks Target” option that allows you to set the focus distance for any camera independently of the asset, but this is a special case. Look for it in the CinemachinePostProcessing extension.

I think Adam’s comment referred to the fact that you can use timeline to animate any Cinemachine setting that isn’t an asset.

Ah, OK. I understand. Thanks for the reply!

Yes and you can also use the PPS volumes as a way to drive values, blending between different volumes is effectively a set of keyframes for as many values as you want. You’re not directly keyframing, but you’re blending between different volumes of desired settings.

why has this to be so hacky? I see no reason not to allow to animate this kind of stuff. Especially for Cutscenes…

16 Likes

I really agree with oumur.
The post process has never been static on any content…

6 Likes

I think it would be convenient to be able to use Timeline to control post-processing, maybe a custom track or something.

3 Likes

I really wonder what is the reason for this. Animating Post-processing effects is useful in many situations. How to request this as a feature?

4 Likes

My natural inclination was to start animating the post processing values as I would any other value but I quickly saw that this was not possible. While it would be nice to be able to directly animate these values I am willing to learn how to do this using multiple volumes. I just need a better picture in my head to get started. So are you saying we could duplicate our current post-processing volume, create a new profile, change the values we want, make it Not Global and then have the physical volume “box” slide into place via animation?

You start with a global volume containing the effects you want. To animate a specific value within an effect, create another global volume with only that effect in it, with a new value for the effect. This will override the value in your default profile. The weight of that override volume dictates how much it will blend with the other active volumes. You can animate the weight in Timeline.

This doc might help give you an overview of what’s going on:
https://docs.unity3d.com/Packages/com.unity.postprocessing@2.0/manual/Quick-start.html#post-process-volumes

If you’re using Cinemachine, you can attach PostProcessing effects to virtual cameras, and they will blend in and out along with the vcams. Under the hood, CM is creating dynamic global profiles containing the override effects, and animating their weights.

5 Likes

Ah bingo! Thank you as always Sir Gregoryl!

2 Likes

Compared to other software the whole setup of Unity and their post-processing and volumes is so annoying! Why does it have to be so hard to animate a DOF in this software! I don’t personally like the idea of blending between volumes in this instance. Plus all cameras in a scene may have different DOF which means you can’t really animate a focal shift cleanly with an override or can you?

If you are using a timeline for camera animation, why can’t it just see all the keyable properties for the volume overrides even if it is its own asset?
As if you are using DOF and in manual mode, I personally want direct animation control of it. As if someone picks up my file they can clearly see what’s been affected and animated and not have to go through every volume in a scene to find out what one had X setting… Seem very un artist-friendly and slow to get results.

5 Likes

Currently, you can write a script to set your PostProcessVolume’s values at runtime, then you keyframe the values on your script.

yourPostProcessEffectSettings.yourParameter.value = newValue;```

Note that .profile will instantiate a new cloned profile like mesh and sharedMesh, but since it's in a cutscene so you probably want to use this instead of .sharedProfile to not messing around with your asset.
1 Like

Yeah the design decision is really weird, maybe there is a reasonable explanation, Philip’s method seems to be the way

I really wish they would let us change the values inside an animation or timeline. I understand they are shared, but sometimes we just want to apply an effect for a brief period of time and have it fade in and fade out.

1 Like

The easiest way to do this is to make a global volume with the effect and animate its weight to blend it in and out.

3 Likes

Would be great if it was more artist intuitive than just constantly applying volumes to everything to band aid the approach. It really would be great if you could do it inside the object you want x to happen. All these extra things you need to keep adding makes unity very messy. Why is it even called a volume? surely you want it call it something that is almost universal in the naming.

I do like Unity but I personally get frustrated that things are all over the place and in all different menus and not at all logical at the best of times. Admittedly I am coming to this from many years VFX and having learned multiple different software’s and pipelines over the years. Maybe this is normal in game engine software.

2 Likes

@Gregoryl using volumes to animate post effects is hacky. The method you describe works if you want to animate a single group of effects linearly, but if you want to animate individual effects more granularly then the volume setup balloons quickly. There are a lot of screen effects out there that work with Unity’s post processing system and there isn’t a great solution for animating them.

Agreed, it’s not the most convenient solution, but while asset properties remain not directly animatable in Unity, we’re kind of stuck with these awkward workarounds.

One thought: maybe it’s possible to make a helper script that can expose specific PP properties for animation, and under the hood create and manage dynamic profiles and manipulate their weights. That’s what Cinemachine is doing for focus distance. Maybe this approach can be generalized. Might make a good asset-store offering :slight_smile:

@Gregoryl Hi Gregory, I have been doing the blending two volumes methods, but I encountered massive lag and jittering during the blending. I have tested it in different computers, even with a gtx 1080Ti. The lag is all over the place while blending the two volumes. Is there any workaround for that? Thank you.

ps: I used a frame debugger and found out that there is a CommandBuffer VolumeBlending happening, and then there are two 4096x4096 luts under the commandBuffer. I assume it is causing the lag due to creating large resolution luts every frame?