pbrSpecularGlossinessMaterial.js 1.2 KB

1234567891011121314151617181920212223242526272829303132
  1. //This file is automatically rebuilt by the Cesium build process.
  2. export default "/**\n\
  3. * Compute parameters for physically based rendering using the\n\
  4. * specular/glossy workflow. All inputs are linear; sRGB texture values must\n\
  5. * be decoded beforehand\n\
  6. *\n\
  7. * @name czm_pbrSpecularGlossinessMaterial\n\
  8. * @glslFunction\n\
  9. *\n\
  10. * @param {vec3} diffuse The diffuse color for dielectrics (non-metals)\n\
  11. * @param {vec3} specular The reflectance at normal incidence (f0)\n\
  12. * @param {float} glossiness A number from 0.0 to 1.0 indicating how smooth the surface is.\n\
  13. * @return {czm_pbrParameters} parameters to pass into {@link czm_pbrLighting}\n\
  14. */\n\
  15. czm_pbrParameters czm_pbrSpecularGlossinessMaterial(\n\
  16. vec3 diffuse,\n\
  17. vec3 specular,\n\
  18. float glossiness\n\
  19. ) \n\
  20. {\n\
  21. czm_pbrParameters results;\n\
  22. \n\
  23. // glossiness is the opposite of roughness, but easier for artists to use.\n\
  24. float roughness = 1.0 - glossiness;\n\
  25. results.roughness = roughness * roughness;\n\
  26. \n\
  27. results.diffuseColor = diffuse * (1.0 - max(max(specular.r, specular.g), specular.b));\n\
  28. results.f0 = specular;\n\
  29. \n\
  30. return results;\n\
  31. }\n\
  32. ";