You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

GrassMaterial.glsl 871B

123456789101112131415161718192021222324252627
  1. uniform vec4 grassColor;
  2. uniform vec4 dirtColor;
  3. uniform float patchiness;
  4. czm_material czm_getMaterial(czm_materialInput materialInput){
  5. czm_material material = czm_getDefaultMaterial(materialInput);
  6. vec2 st = materialInput.st;
  7. float noise1 = (czm_snoise(st * patchiness * 1.0)) * 1.0;
  8. float noise2 = (czm_snoise(st * patchiness * 2.0)) * 0.5;
  9. float noise3 = (czm_snoise(st * patchiness * 4.0)) * 0.25;
  10. float noise = sin(noise1 + noise2 + noise3) * 0.1;
  11. vec4 color = mix(grassColor, dirtColor, noise);
  12. //Make thatch patterns
  13. float verticalNoise = czm_snoise(vec2(st.x * 100.0, st.y * 20.0)) * 0.02;
  14. float horizontalNoise = czm_snoise(vec2(st.x * 20.0, st.y * 100.0)) * 0.02;
  15. float stripeNoise = min(verticalNoise, horizontalNoise);
  16. color.rgb += stripeNoise;
  17. material.diffuse = color.rgb;
  18. material.alpha = color.a;
  19. return material;
  20. }