NormalMapMaterial.js 733 B

1234567891011121314151617
  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. czm_material czm_getMaterial(czm_materialInput materialInput)\n\
  6. {\n\
  7. czm_material material = czm_getDefaultMaterial(materialInput);\n\
  8. vec4 textureValue = texture2D(image, fract(repeat * materialInput.st));\n\
  9. vec3 normalTangentSpace = textureValue.channels;\n\
  10. normalTangentSpace.xy = normalTangentSpace.xy * 2.0 - 1.0;\n\
  11. normalTangentSpace.z = clamp(1.0 - strength, 0.1, 1.0);\n\
  12. normalTangentSpace = normalize(normalTangentSpace);\n\
  13. vec3 normalEC = materialInput.tangentToEyeMatrix * normalTangentSpace;\n\
  14. material.normal = normalEC;\n\
  15. return material;\n\
  16. }\n\
  17. ";