Search Unity

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).