Cinemachine: Using Blend List to Create A Security Camera
In this article, we are going to cover Cinemachine’s Blend List and Post-Processing extension to create a security camera(s).
Blend List Camera Setup
The Cinemachine Blend List Camera component executes a sequence of blends or cuts among its child Virtual Cameras.
Create a new Blend List Camera from the Cinemachine window.
This will create a Blend List Camera game object that has two virtual cameras as children. You can add or remove virtual cameras using the plus and minus in the Virtual Camera Children list.
The child cameras do not have to remain as transposer cameras, but they can be any type of Cinemachine camera (tracked, dolly, 3rd person, etc).
Once you have all of your virtual setup and positioned, we can start to add the transitions between the different cameras and how those transitions will be blended.
I have 4 children cameras (red box), but currently have 2 cameras in the Blending List (yellow box)
The Blend List starts with virtual camera 1 from the Virtual Camera Children and it will HOLD on that camera for 1 second. You can adjust the HOLD time to your desire time.
Then it will transition or blend to virtual camera 2 with an Ease In Out movement for a duration of 2 seconds. The transition or blend duration can be adjusted to whatever time you would like.
There are different type of transition or blend movements built-in or you can create a custom blend. Below is the definitions of each Blend In according to Unity’s documentation.
Below you can see how to add other cameras to the Blend List, how to reorder and remove cameras from the list.
Once you have your camera blend list with the blend-ins set, you can loop it to have those transition continuous play.
Now, you can have dynamic camera transitions and movement without a single line of code.
Basic Security Camera
For this basic security camera, we will create a new Blend List Camera and make sure the two children cameras have the same transform, Field of View, and any other settings that will make their view identical.
With the first virtual camera, we will just rotate on the Y-axis and Solo the view to check the position to make sure we like the view.
For the second virtual camera, we will rotate the opposite way on the Y-axis. Again, using Solo view to check the position.
Now, lets go to the Blend list and set the order and Blend-Ins for these two cameras. The desired movement is just to have the camera pan left and right in a loop.
We select Loop to have it loop through the camera list continuously. The first step is starting with camera 1’s view and hold there for 1 second, then move to camera 2 with a linear movement (straight movement) for 2 seconds and hold at the final camera 2 position for 2 seconds. Lastly, it will move back to camera 1’s position in the same fashion, but hold there for only 1 second since it will loop back to camera 1 again which is held for 1 second. This makes the total hold time 2 seconds, making everything equal.
Here you can see the final result. Again, an easy way for camera movement without having to write any code.
We are going to add a green tint to the cameras to give it that security feel. This can be done by adding post processing. Make sure the the Post Process package has been downloaded and installed into the project from the Package Manager.
Add a Post-Process Layer to the Main Camera. It needs a Post-Processing Volume, so…
Create an Empty game object and add a Post-Processing Volume and create a New Profile.
Add a new Layer and set the Post-Processing Volume to this Layer.
Back to the Main Camera, select the Layer to this new Post-Processing Layer.
Now, you can add an effect to the Main Camera. Just make sure the Layer for the Volume and Main Camera are the same.
Now, we can create a new Post-Processing Profile to our virtual camera(s). On the Cinemachine virtual camera, add a Post Processing Extension.
Create a New Post-Processing Profile and add the effects you want to apply to that camera.
Below you can see how the Post-Processing Profile transition from the one applied to the virtual camera 1 to the Global Profile that is applied to virtual camera 2.
To make sure both virtual cameras are uniformed to make the security cameras, we just have to add the Post-Processing extension to virtual camera 2 and add the Post-Processing Profile that was made for the first virtual camera.
Now, we have both cameras on the Blend List with the same Post Processing Profile giving them a uniform look.