Sha256: cd3fa2cbb2ba26edb08cf503bfdde6bd9536b7ea350a7e1a8d03d76a5f60a128

Contents?: true

Size: 1.08 KB

Versions: 11

Compression:

Stored size: 1.08 KB

Contents

/**
 * Calculates the specular intensity of reflected light.
 *
 * @name czm_getSpecular
 * @glslFunction
 *
 * @param {vec3} lightDirectionEC Unit vector pointing to the light source in eye coordinates.
 * @param {vec3} toEyeEC Unit vector pointing to the eye position in eye coordinates.
 * @param {vec3} normalEC The surface normal in eye coordinates.
 * @param {float} shininess The sharpness of the specular reflection.  Higher values create a smaller, more focused specular highlight.
 *
 * @returns {float} The intensity of the specular highlight.
 *
 * @see czm_phong
 *
 * @example
 * float diffuseIntensity = czm_getLambertDiffuse(lightDirectionEC, normalEC);
 * float specularIntensity = czm_getSpecular(lightDirectionEC, toEyeEC, normalEC, 200);
 * vec3 color = (diffuseColor * diffuseIntensity) + (specularColor * specularIntensity);
 */
float czm_getSpecular(vec3 lightDirectionEC, vec3 toEyeEC, vec3 normalEC, float shininess)
{
    vec3 toReflectedLight = reflect(-lightDirectionEC, normalEC);
    float specular = max(dot(toReflectedLight, toEyeEC), 0.0);
    return pow(specular, shininess);
}

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
cesium-1.24.0 app/assets/javascripts/Cesium/Shaders/Builtin/Functions/getSpecular.glsl
cesium-1.23.0 app/assets/javascripts/Cesium/Shaders/Builtin/Functions/getSpecular.glsl
cesium-1.18.0 app/assets/javascripts/Cesium/Shaders/Builtin/Functions/getSpecular.glsl
cesium-1.17.0 app/assets/javascripts/Cesium/Shaders/Builtin/Functions/getSpecular.glsl
cesium-0.25.0 app/assets/javascripts/Shaders/Builtin/Functions/getSpecular.glsl
cesium-0.24.1 app/assets/javascripts/Shaders/Builtin/Functions/getSpecular.glsl
cesium-0.24.0 app/assets/javascripts/Shaders/Builtin/Functions/getSpecular.glsl
cesium-0.23.0 app/assets/javascripts/Shaders/Builtin/Functions/getSpecular.glsl
cesium-0.22.0 app/assets/javascripts/Shaders/Builtin/Functions/getSpecular.glsl
cesium-0.21.1 app/assets/javascripts/Shaders/Builtin/Functions/getSpecular.glsl
cesium-0.21 app/assets/javascripts/Shaders/Builtin/Functions/getSpecular.glsl