Search Unity

Question Phong question from Unity Shader Bible

Discussion in 'Shaders' started by SavedByZero, Nov 12, 2022.

  1. SavedByZero

    SavedByZero

    Joined:
    May 23, 2013
    Posts:
    124
    Newbie to shaders here.

    I'm having trouble understanding what the Unity Shader Bible is trying to tell me (not for the first time, alas -- this book really needs a clarity pass). On page 222 it says "[...] Specular Reflection has the same angle as the light direction. This creates a problem that, if your eye/camera is not in the same direction of reflection, you will not be able to see it. To solve this, you can calculate an intermediate vector between the normals and the light direction, following the view direction."

    First off: what does "your eye/camera is not in the same direction of reflection" actually mean? That your eye isn't on the receiving end of the reflected angle at the exact right spot?
    Second, if my assumption above is correct: Why would calculating this intermediate vector halfway between the normal and the reflected angle somehow make a difference? All it seems to do is add one more vector, so now your eye has to be in one of two positions to be able to see the reflection, instead of just that one position. What am I missing?

    Thanks!
     
    Last edited: Nov 12, 2022
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,445
  3. SavedByZero

    SavedByZero

    Joined:
    May 23, 2013
    Posts:
    124
    So what's being said here is that you're actually calculating the difference between where your eye is and where the light reflection is, and compensating for that based on said calculation?
    That...makes a lot more sense than the way it was worded in that book.