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
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

Help with basic shader!

Discussion in 'Shaders' started by Yoshimaster96, Aug 30, 2015.

  1. Yoshimaster96

    Yoshimaster96

    Joined:
    Aug 30, 2015
    Posts:
    5
    Before I move on to Fresnel and other things, I'd like to know if this is correct.

    D diffuse
    S specular
    L lambert diffuse (max(0, n dot l) * 0.5 * D) + 0.5 * D
    C cubemap color from reflected vector
    F final color (L + (C * S)) / 2
     
  2. Yoshimaster96

    Yoshimaster96

    Joined:
    Aug 30, 2015
    Posts:
    5
    Figured it out. Instead of the weight being 0.5 for both L and (C * S), it should be the brightness (the max rgb value) for the specular term and one minus that for the diffuse term.
     
  3. Yoshimaster96

    Yoshimaster96

    Joined:
    Aug 30, 2015
    Posts:
    5
    Whoops. The max weight is only on the diffuse. The specular is just (C * S).