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

Question How to get Camera FOV in Shader Graph?

Discussion in 'Shader Graph' started by Glitshy, Feb 15, 2022.

  1. Glitshy

    Glitshy

    Joined:
    May 26, 2018
    Posts:
    15
    Hello,

    I want to use the camera FOV in a shader. I am aware of the camera node which contains the position and direction, but is there a way to get the FOV? I'm using URP in case that's relevant.

    Thanks in advance
     
  2. Glitshy

    Glitshy

    Joined:
    May 26, 2018
    Posts:
    15
  3. Glitshy

    Glitshy

    Joined:
    May 26, 2018
    Posts:
    15
  4. adam_unity450

    adam_unity450

    Joined:
    Aug 3, 2020
    Posts:
    12
    Seems that the division of -1 by the matrix element is only for the Y axis where the matrix element needs to be negated due to Unity flipped Y on some platforms (when UNITY_UV_STARTS_AT_TOP is defined).

    In all other cases the matrix element shouldn't be negated, i.e. divide 1 by the matrix element.