Godot version: Git https://github.com/godotengine/godot/commit/80b1604fa95b048307815c5eee96426942dd207a
OS/device including version: Fedora 31, NVIDIA GeForce GTX 1080
Issue description:
The shader language doesn't seem to accept constants that use arithmetic operations. In comparison, this seems to work in raw GLSL (tested in SHADERed).
Steps to reproduce:
Paste the following shader into a ColorRect node's material:
shader_type canvas_item;
const float QUARTER_COLOR = 1.0 / 1024.0; // 0.0009765625
void fragment() {
COLOR = textureLod(SCREEN_TEXTURE, SCREEN_UV, 0.0);
vec4 col = COLOR;
// Increase/decrease the pixel colour values slightly in a
// chessboard pattern to achieve a simple dithering against banding.
// Assume 8-bit RGB values and offset values a bit to affect rounding.
if (mod(FRAGCOORD.x + FRAGCOORD.y, 2) == 1.0) {
COLOR.rgb += vec3(QUARTER_COLOR);
} else {
COLOR.rgb -= vec3(QUARTER_COLOR);
}
}
This will result in the error message: error(3): Expected constant expression after '='
Minimal reproduction project: test_dithering.zip
I will look to fix this...
This is still not fixed btw
@arthur109 Please open a new issue with a minimal reproduction project attached.
Most helpful comment
I will look to fix this...