Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

Depth Of Field

Discussion in 'High Definition Render Pipeline' started by liccardi, Jan 26, 2022.

  1. liccardi

    liccardi

    Joined:
    Dec 6, 2018
    Posts:
    16
    hello everyone, sorry for the trivial question, but I still don't understand how it works, then I would like an effect similar to this, when I examine an object, that is when I click the "t" key, the object is examined, so yes approach the room and I would like to give this effect in the photo, how can I do?
    the image I took from the web, but the effect I would like is this in the picture.
    I tried to access the various parameters like this:
    Code (CSharp):
    1.                     DoF.nearFocusStart = new MinFloatParameter(6f, 0f, true);
    2.                     DoF.nearFocusEnd = new MinFloatParameter(9f, 0f, true);
    3.                     DoF.focusDistance.value = 9f;
    4.  
    5.                     DoF.farFocusStart = new MinFloatParameter(0f, 0f, true);
    6.                     DoF.farFocusEnd = new MinFloatParameter(6.6f, 0f, true);
    but I was unable to achieve this effect.
    ah, I use HDRP as the Pipeline.
     
  2. liccardi

    liccardi

    Joined:
    Dec 6, 2018
    Posts:
    16
  3. chap-unity

    chap-unity

    Unity Technologies

    Joined:
    Nov 4, 2019
    Posts:
    701
    Here's an example from the documentation on how to access / change parameters from an override at runtime that might help you achieve what you want.
     
    Olmi likes this.