Forum rules - please read before posting.

Local Post-processing volumes

Hi all

Can I ask advice about how to handle post-processing local volumes? If I want to have different local post processing volumes for different cameras, is the easiest way to do that to have a number of local volumes around the main camera and enable them via a custom action as required? Or is there a way in AC?

My use case here is that I have a number of security cameras which the player will control. Most share one profile but several have custom profiles. All in all it's a large number of variations to track and I wonder whether there is an efficient way to handle it or even to have the local AC gamecameras Camera component used for some cutscenes, rather than using the main camera (that would make it very straightforward).

Olly

Comments

  • Ultimately, it's still a case of the MainCamera performing the rendering - think of GameCameras as just positional references for it - but you can still associate volumes with GameCameras and use scripting to manipulate them when a given camera is switched to.

    The OnSwitchCamera custom event is called whenever a camera-switch takes place. What form a custom script would take exactly would depend on your needs, but one approach would be to attach volumes to each GameCamera, and have the script enable the one on the new camera, and disable the one on the old camera:

    using UnityEngine;
    using AC;
    
    public class VolumeHandler : MonoBehaviour
    {
    
        private void OnEnable () { EventManager.OnSwitchCamera += SwitchCamera; }
        private void OnDisable () { EventManager.OnSwitchCamera -= SwitchCamera; }
    
        private void SwitchCamera (_Camera old, _Camera newCamera, float tt)
        {
            var oldVolume = GetComponent<UnityEngine.Rendering.Volume> ();
            var newVolume = GetComponent<UnityEngine.Rendering.Volume> ();
    
            if (oldVolume) oldVolume.enabled = false;
            if (newVolume) newVolume.enabled = true;
        }
    
    }
    
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Welcome to the official forum for Adventure Creator.