diff --git a/src/Shaders/Gradients/LinearDithering.gdshader b/src/Shaders/Gradients/LinearDithering.gdshader index 20f5e6120..af5e37179 100644 --- a/src/Shaders/Gradients/LinearDithering.gdshader +++ b/src/Shaders/Gradients/LinearDithering.gdshader @@ -71,7 +71,12 @@ void fragment() { modified_uv = mirror_fract(modified_uv); vec4 output; - for (int i = 1; i <= n_of_colors; i++) { + // Note for the future, please remember to change 100 to n_of_colors when we + // use GLES3 for the Web version. A constant number is used to make it work in WebGL 1.0. + for (int i = 1; i <= 100; i++) { + if(i > n_of_colors) { + break; + } float colors_minus = float(n_of_colors - 1); float off = texture(offset_texture, vec2(float(i) / colors_minus)).r; float off_prev = texture(offset_texture, vec2(float(i - 1) / colors_minus)).r; diff --git a/src/UI/Dialogs/ImageEffects/GradientDialog.gd b/src/UI/Dialogs/ImageEffects/GradientDialog.gd index 59b978415..b9e6d814e 100644 --- a/src/UI/Dialogs/ImageEffects/GradientDialog.gd +++ b/src/UI/Dialogs/ImageEffects/GradientDialog.gd @@ -3,7 +3,7 @@ extends ImageEffect enum { LINEAR, RADIAL, LINEAR_DITHERING, RADIAL_DITHERING } var shader_linear: Shader = preload("res://src/Shaders/Gradients/Linear.gdshader") -var shader_linear_dither: Shader +var shader_linear_dither: Shader = preload("res://src/Shaders/Gradients/LinearDithering.gdshader") var shader: Shader = shader_linear var dither_matrices := [ @@ -42,11 +42,6 @@ func _ready() -> void: var sm := ShaderMaterial.new() sm.shader = shader preview.set_material(sm) - if _is_webgl1(): - dithering_label.visible = false - dithering_option_button.visible = false - else: - shader_linear_dither = load("res://src/Shaders/Gradients/LinearDithering.gdshader") for matrix in dither_matrices: dithering_option_button.add_item(matrix.name)