NormalMapMaterial.js 795 B

123456789101112131415161718192021
  1. //This file is automatically rebuilt by the Cesium build process.
  2. export default "uniform sampler2D image;\n\
  3. uniform float strength;\n\
  4. uniform vec2 repeat;\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. vec4 textureValue = texture(image, fract(repeat * materialInput.st));\n\
  11. vec3 normalTangentSpace = textureValue.channels;\n\
  12. normalTangentSpace.xy = normalTangentSpace.xy * 2.0 - 1.0;\n\
  13. normalTangentSpace.z = clamp(1.0 - strength, 0.1, 1.0);\n\
  14. normalTangentSpace = normalize(normalTangentSpace);\n\
  15. vec3 normalEC = materialInput.tangentToEyeMatrix * normalTangentSpace;\n\
  16. \n\
  17. material.normal = normalEC;\n\
  18. \n\
  19. return material;\n\
  20. }\n\
  21. ";