RimLightingMaterial.js 771 B

123456789101112131415161718192021222324
  1. //This file is automatically rebuilt by the Cesium build process.
  2. /*global define*/
  3. define(function() {
  4. "use strict";
  5. return "uniform vec4 color;\n\
  6. uniform vec4 rimColor;\n\
  7. uniform float width;\n\
  8. \n\
  9. czm_material czm_getMaterial(czm_materialInput materialInput)\n\
  10. {\n\
  11. czm_material material = czm_getDefaultMaterial(materialInput);\n\
  12. \n\
  13. // See http://www.fundza.com/rman_shaders/surface/fake_rim/fake_rim1.html\n\
  14. float d = 1.0 - dot(materialInput.normalEC, normalize(materialInput.positionToEyeEC));\n\
  15. float s = smoothstep(1.0 - width, 1.0, d);\n\
  16. \n\
  17. material.diffuse = color.rgb;\n\
  18. material.emission = rimColor.rgb * s; \n\
  19. material.alpha = mix(color.a, rimColor.a, s);\n\
  20. \n\
  21. return material;\n\
  22. }\n\
  23. ";
  24. });