Advertisement
Guest User

Untitled

a guest
Aug 25th, 2019
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. #define DENSITY 16.0
  2. #define OPACITY 0.6
  3. #define GRASSCOLOR vec3(.325, 0.6, 0.1)
  4. #define WALLCOLOR vec3(0.477, 0.316, 0.164)
  5. #define ROADCOLOR vec3(.133, 0.125, 0.125)
  6. #define YELLOW vec3(0.7,0.6,0.2)
  7.  
  8. float getnoise(vec2 uv, float density) {
  9. vec2 noiseUV = floor(uv.xy * density) / density;
  10. return fract(sin(dot(noiseUV, vec2(43928.2908985, 23234.393201))) * 3215.241466);
  11. }
  12.  
  13. void mainImage( out vec4 fragColor, in vec2 fragCoord ) {
  14. vec2 uv = fragCoord/iResolution.xy;
  15.  
  16. vec3 diffuse = vec3(0.0);
  17. if (uv.x < 0.5) {
  18. if (uv.y < 0.5) {
  19. diffuse = ROADCOLOR;
  20. }
  21. else {
  22. diffuse = YELLOW;
  23. }
  24. }
  25. else {
  26. if (uv.y < 0.5) {
  27. diffuse = GRASSCOLOR;
  28. }
  29. else {
  30. diffuse = WALLCOLOR;
  31. }
  32. }
  33.  
  34. float n = getnoise(uv, DENSITY);
  35. vec3 outcol = diffuse + diffuse * n * OPACITY;
  36.  
  37.  
  38. fragColor = vec4(outcol,1.0);
  39. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement