RimLightingMaterial.js 821 B

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