Search Unity

Question How to animate/transition between noise profiles without 'pop'

Discussion in 'Cinemachine' started by jrhager84, Feb 28, 2023.

  1. jrhager84

    jrhager84

    Joined:
    Oct 8, 2018
    Posts:
    18
    How would I animate the noise profiles between a shakier profile and an idle profile without a 'pop' happening when you switch the profile? I've scoured the documentation and look on YouTube, etc (as well as here) and I don't really see a way to programmatically adjust the amplitude of the profiles. Please point me in the right direction if there is a resource for it.

    The objective is - As an object gets closer, the noise profile gets shakier and shakier. However, at the edge of the range, the profile is switched from an escape profile (way more shaky and noisy) to an idle animation (this is the idle cam motion). Is there a better way of setting this up that I just don't know? Thanks!
     
  2. Gregoryl

    Gregoryl

    Unity Technologies

    Joined:
    Dec 22, 2016
    Posts:
    7,706
    You can access the amplitude from script:
    Code (CSharp):
    1. vcam.GetCinemachineComponent<CinemachineBasicMultiChannelPerlin>().m_Amplitude = bla;
    However, in your case it might be more interesting to set up 2 vcams: one for idle with its noise profile, and another with the shaking profile. To transition between them, activate one vcam or the other, allowing the CMBrain to blend smoothly. If you change the noise profile of the vcam, there will likely be a pop.

    As another alternative, you could implement your own Noise component that takes multiple profiles and blends them together according to weights you set. You would use it instead of CinemachineBasicMultiChannelPerlin. Start with a renamed copy of CinemachineBasicMultiChannelPerlin.cs, and modify it to add your extra functionality.

    Yet another alternative: use Impulse. Your approaching object would emit an impulse signal (which dissipates with distance so is automatically weaker when it is farther way), and your camera would shake in reaction to it, independently of its normal camera noise.
     
    Last edited: Feb 28, 2023