DotMaterial.glsl 526 B

1234567891011121314151617
  1. uniform vec4 lightColor;
  2. uniform vec4 darkColor;
  3. uniform vec2 repeat;
  4. czm_material czm_getMaterial(czm_materialInput materialInput)
  5. {
  6. czm_material material = czm_getDefaultMaterial(materialInput);
  7. // From Stefan Gustavson's Procedural Textures in GLSL in OpenGL Insights
  8. float b = smoothstep(0.3, 0.32, length(fract(repeat * materialInput.st) - 0.5)); // 0.0 or 1.0
  9. vec4 color = mix(lightColor, darkColor, b);
  10. material.diffuse = color.rgb;
  11. material.alpha = color.a;
  12. return material;
  13. }