FANDOM


This script updates the active post-processing profile with the AC-calculated depth-of-field focus distance.

To use:

  1. Download and install Unity's Post Processing Stack asset here
  2. Attach the Post Processing Behaviour component to AC's MainCamera, and enable Depth Of Field in the profile
  3. Attach the script below to the MainCamera as well
using UnityEngine;
using UnityEngine.PostProcessing;
using AC;

public class CopyDOF : MonoBehaviour
{

    public float fStop = 2f;
    private PostProcessingProfile profile;

    private void Start ()
    {
        profile = GetComponent <PostProcessingBehaviour>().profile;
    }


    private void Update ()
    {
        DepthOfFieldModel.Settings dofSettings = profile.depthOfField.settings;
        dofSettings.focusDistance = KickStarter.mainCamera.GetFocalDistance ();
        dofSettings.aperture = fStop;
        dofSettings.useCameraFov = true;
        profile.depthOfField.settings = dofSettings;
    }

}

Ad blocker interference detected!


Wikia is a free-to-use site that makes money from advertising. We have a modified experience for viewers using ad blockers

Wikia is not accessible if you’ve made further modifications. Remove the custom ad blocker rule(s) and the page will load as expected.