OpenSimplexNoise_Viewer.shader 367 B

123456789101112131415161718192021
  1. shader_type canvas_item;
  2. uniform float min_value = -1;
  3. uniform float max_value = 1;
  4. void fragment() {
  5. // Get the color.
  6. vec4 color = texture(TEXTURE, UV);
  7. // Compare the value.
  8. float gray = color.x;
  9. if (gray < min_value) {
  10. color = vec4(0, 0, 0, 1);
  11. } else if (gray > max_value) {
  12. color = vec4(1, 1, 1, 1);
  13. }
  14. // Write back the color.
  15. COLOR = color;
  16. }