Separate focus distance for every virtual camera

Hello, I have created a product visualisation with a cinemachine and 3 virtual cameras. So you can switch between 3 camera positions.

Now I want to add some depth of field. So every virtual camera needs a different focus distance. But I can only adjust the focus distance on the main camera which affects all virtual cameras.
How can I set the focus distance for every virtual camera?

Thank you

Are you using HDRP, or URP, or builtin graphics?

In HDRP or URP, focus distance is set using a volume with post-processing effect. You can add post-processing effects to the vcam, and they will blend in and out along with the vcam. Use the CinemachineVolumeSettings extension…

1 Like

Thanks a lot. With the CinemachineVolumeSettings it finally worked.

I was watching some tutorials and tried to use a Post Process Volume and Post Process Layer but this never worked for me.

Im using HDRP.

Is there a way to also use a different focus distance for the Top, Middle and Bottom Rig in the Free Look Camera?

The best way would be to use the FocusTracking field inside VolumeSettings. Set the target to be your LookAt target. It will dynamically adjust the focus distance to match the target.

It seems this only works if the Focus Mode in Depth of Field is set to Physical Camera. But then the front of the object is also blurred, what I don’t want.

If I set Focus Mode to Manual Ranges I can make the background getting blurred without affecting the front, but now the focus point doesn’t adjust to the camera height.

I probably need some kind of the autofocus system.

Yes, focus tracking only works with physical mode, because it manipulates the focus distance. To focus on the front of the object, you can adjust the focus tracking offset.

I have a very last question. Is there a simple way to set up a start position for the FreeLookCamera when using cinemachine rig?

What is the Binding Mode of the FreeLook?

Binding Mode is World Space

So the camera position is determined by the target position and by the Value members of the FreeLook’s X and Y axes. You can set the values to be what you want at start time. You can’t directly set the transform because the FreeLook’s positioning algorithm will overwrite it.

Ok, thank you.