I’ve posted couple of times already but maybe this is the correct thread area.
How can I control animate depth of field and/or post process profile parameters correctly with timeline editor.
How is this not an option?
Bear with me i’m new with unity but not new to this field.
We wrote some custom scripts to expose post profile parameters to be able to animate them inside ‘animation’, but we are still running into problems when it comes to playing back these animation inside the timeline editor with everything else. Just the fact that I need the framing to be composed in order to work the depth of field is another problem, can’t do both at the same time.
There must be a simpler way to do this simple task.
Everything is becoming a guess work and not so intuitive.
Don’t need an auto focus script either I want to be able to manually animate the depth of field at a given frame or time inside a cut scene built within timeline editor.
@knocking Thing is, the PostProcessing profiles are assets, and the timeline editor is not designed to animate assets - only GameObjecds.
However, I think you can probably make a simple workaround. Create a behavior that sets the DOF in OnUpdate, according to a parmeter it exposes. Then animate that parameter from Timeline. You can animate any field in any behaviour by creating an animation track in Timeline.
The fact that we are controlling an asset this way when it comes to the post process profile and especially depth of field is in my humble opinion the problem (please correct me if i’m wrong).
1 - You need to write a custom script to expose the parameters of the post process in order for it to work inside the animation, this is already an issue of time and otherwise. As the script needs to work both in editor and in game in order to visualize the shot and frame it before seeing results, it has proven to be unstable so far.
2 - You need to lock the timeline editor after creating it in order to be able to scrub the timeframe so you can frame and compose the shot while you select other elements in the editor (such as the post process profile to manipulate it), but by doing so this seems to disable Auto keying of any parameter that was exposed by the script for the post process profile, creating more workarounds by forcing us to copy paste values manually on an animation track.
3 - The final animation track with the keyed elements of the post process track randomly chooses to work or not inside the timeline editor. (this may be due to the way our script is exposing/recording things, currently but we are still looking into it).
In conclusion, what is supposed to have been a simple straight forward task inside a new editor hailed to provide ‘cinematic’ controls has turned into almost a week of back and forth without a solution so far over one of the most basic important features of a movie making process (the depth of field).
We will test things further but i thought to let this known here for now for any help/guidelines or even docs are appreciated.
I will try to update here if we find any solutions that work.
Quick update: We managed to make this work with our own script that can update the editor view and the gameplay at the same time, this allows us to frame the shot and amend parameters at the same time for the timing. Unfortunately the process is still clunky and slow. I hope Unity devs would address this and come up with a smoother approach out of the box in the future.
We designed it this way because you usually want to focus on a subject and the offset is used for little rack focuses or to add an organic bit of ‘seek’ to the focus to make it look more realistic.
If you want to do huge rack focuses, simply blend between two virtual cameras with different targets.
I didn’t try Cinemachine yet, I could find little documentation about it (I guess all the auto tracking camera things put me off, we prefer to have our own animations imported from other software), I will try this soonest possible and let you guys know.
Hi, sorry to keep bothering you all with this, but i’m running into a problem with Cinemachine from the start, when i create a virtual camera it seems to ‘override’ my main imported camera which already contains animation and then centers it. Is there a way to make this work with an already animated camera?
Yes, just turn the Cinemachine virtual cameras off. When you turn on a virtual camera, it will use the Default Blend to blend from the Main Camera to a CM virtual camera. You can set up custom blends in the Custom Blend area to setup specific blends to and from any camera
It’s overriding because it’s active - meaning it’s using the new virtual camera instead of your old one because you’ve asked for a new camera to play. If you want your old camera, don’t turn new ones on.
CM does come with a little adapter script designed to expose non-CM cameras to the CM system as virtual cameras. Instead of creating a VirtualCamera, try add a CinemachineExternalCamera behaviour to your externally-animated camera.
Be careful, however. A paradigm shift is involved. There needs to be a separate Main camera, with a CinemachineBrain on it, that will position itself to match the currently active Virtual Camera. Your externally-animated camera will never be an active camera - instead, it will act as a virtual camera and transmit its state info to the Main camera via the CinemachineExternalCamera script.
I still have a few things that i’m struggling with.
I managed to link up the external camera to a virtual one, but i’m unable to make the post process focus offset work. Another question would be as to how can I animate the other settings from directly inside the post process stack such as exposure/color grade with this approach?
Here’s a quick 1 min video, it shows what i did so far in the scene and where i got stuck.
It’s because you have 2 cameras with the Cinemachine components and it uses the settings from the first camera, just create one Main camera and then virtual cameras from Cinemachine dropdown, then add CinemachinePostFX component, edit focus settings in the PostProcessing asset and it should work fine.
I have a specific situation and was following what @Gregoryl mentioned.
I understood that I have to have an external camera script on my FBX imported Cam: done
I need to create another camera and assign brain, post process behavior and post process fx scripts on it (this acts as main camera now following FBX cam): done
How to animate focus settings/offset or animate color grade settings from here: lost me
Side note: If I create a normal camera and assign Virtual cameras to it, Focus offset would require me to pick a look at target for it to work at all (correct me if i’m wrong but this is what i discovered so far), this works but this also forces the camera to follow that object all the time which i don’t want.
I just need my own animations on the camera and just keyframe control over depth of field and color grade inside timeline editor.
@knocking If you’re doing your own camera animations then Cinemachine is overkill for your purposes. You just want to animate DOF from the timeline. The simplest way to do that is to do what I initially suggested: a behaviour that sets the DOF based on a field, then animate that field from the timeline.
Thanks for the help, I agree Cinemachine isn’t the way to go for me which is why i never looked at it in the first place until it was mentioned here, i think what you suggested is what we had done with our script (dev isn’t here at the moment to clarify) but i noted it wasn’t working in editor mode correctly (which is required if i need to use timeline to work on the framed shots). So what i ended doing is installed the latest Beta of the post processing stack and that one has volumes trigger. With that i was able to blend between different states of the post.
I really wish there would be a more straight forward approach without any scripts in the future (coming from a pure art side of things).
@knocking - one thing - embracing the power of game engines, instant iteration and seeing everything in context. Imagine a world where you don’t have to go back to your 3D program to fix/change/make new cameras.
@ I understand, and I agree, however please keep in mind that sometimes procedural or auto tracking or even blending is not enough. For many of us (especially coming from animation/film backgrounds) it is preferable to have 100% control over certain animations especially in cut scenes, subtleties in motion can be everything in many such situations, which is why we prefer to hand animate or sometimes even mocap camera data and amend it later very carefully before importing it to the engine. It assures the look we would be after.
My feedback so far from what i’ve seen is to simply be able to expose the post effects and animation controls via user friendly ways inside the editor without scripts. So that imported motions can work well, this alongside what you have going for Cinemachine and the new post process stack can be very powerful.
We are working on improving your situation. The Post Processing Stack V2 will have greatly improved Timeline integrations. Your demands are right on target with how we want things to work and I’ll keep you posted.
hey @Adam_Myhill -
so I’m still a touch confused about this. I have two CM VCams, one has “Focus Tracks Target” on, and the other doesn’t. My idea was to animate the “Focus Offset” param, and bring the object into focus, but the value seems to do nothing. I’ve gone from -10000 to +10000 with no change in DoF. What gives?