In this lesson, you will learn how to breathe life into your static camera shots by applying Perlin noise profiles to simulate the subtle, organic movement of a handheld camera.
Understanding Camera Noise
Even when a player or camera is standing still, a real-world handheld camera never stays perfectly locked in space. It experiences micro-jitters due to a human operator's breathing or weight shifts. In Cinemachine, we simulate this using the Noise extension on a CinemachineVirtualCamera.
Instead of manually animating a camera’s transform, which looks repetitive and robotic, we use Perlin Noise. This is a mathematical algorithm that generates smooth, continuous randomness. By applying this to the camera's rotation and position, we achieve an effect that feels natural and immersive.
Implementing Noise Profiles
To add this to your virtual camera:
- Select your
CinemachineVirtualCamerain the Inspector. - Locate the Noise dropdown in the Extensions section.
- Set the Noise Profile to a preset, such as
6D ShakeorHandheld_Tele_Regular. - Adjust the Amplitude Gain and Frequency Gain to tune the intensity.
Think of Amplitude as the distance the camera shakes, and Frequency as the speed of the shake. A low frequency with a medium amplitude creates a slow, drifting "documentary" feel, while high frequency with low amplitude creates a frantic, high-tension atmosphere.
If you need to trigger this effect dynamically through your scripts—such as during an explosion or when the player is running—you can manipulate these values via code:
using Cinemachine;
public class CameraShake : MonoBehaviour
{
public CinemachineVirtualCamera vcam;
public void TriggerShake(float intensity)
{
var noise = vcam.GetCinemachineComponent<CinemachineBasicMultiChannelPerlin>();
noise.m_AmplitudeGain = intensity;
}
}
By layering these noise profiles, you can prevent your game world from feeling like a static "floating tripod" and ground the player in a living, breathing environment.
Key Takeaway: Use Cinemachine’s Perlin Noise profiles to replace perfect static shots with organic, frequency-based micro-movements to enhance visual realism.