Heavybrush
Member
Hi guys
I'm getting into the shaders, I love them but I'm not so good to understand what is going on
the compile errors says:
Fragment Shader: shd_1BitDithering at line 31 : ''
this shader works perfecty in shadertoy and shader editor tool (a very good software on steam to try shaders)
I'm going to try it also on my phone (there is another shader tool, that is an app where I learned a lot on shaders)
seems to be here there is not a compile error
because the shader works in other places but here it doesn't want that if
it says error on lne 31 but the problem is on the whole if
if I delete it the shader works (but obviously is all black)
what can I do to solve this problem?
thank you so much
I'm getting into the shaders, I love them but I'm not so good to understand what is going on
C:
varying vec2 v_vTexcoord;
varying vec4 v_vColour;
uniform vec2 resolution;
uniform float pixelSize;
uniform float gamma;
void main()
{
vec2 uv = gl_FragCoord.xy / resolution.xy;
float alpha = 1.0;
vec4 color = v_vColour * texture2D( gm_BaseTexture, v_vTexcoord );
gl_FragColor = color;
float pixelSize = 3.0;
float gamma = 3.0;
vec2 pseudoResolution = floor(resolution.xy / pixelSize);
vec2 pseudoPixel = floor(gl_FragCoord.xy / pixelSize);
vec2 pseudoUv = pseudoPixel / pseudoResolution;
vec3 tex = texture2D(gm_BaseTexture, pseudoUv).rgb;
float bw = (tex.r + tex.g + tex.b) / gamma;
float col = 0.0;
if(bw > 0.8) {
col = 1.0;
} else if(bw > 0.6) {
col = float(!(int(pseudoPixel.x) % 2 == 0 && int(pseudoPixel.y) % 2 != 0));
} else if(bw > 0.4) {
col = float((int(pseudoPixel.x) % 2 + int(pseudoPixel.y) % 2) % 2 == 0);
} else if(bw > 0.2) {
col = float(int(pseudoPixel.x) % 2 == 0 && int(pseudoPixel.y) % 2 == 0);
}
gl_FragColor = color * vec4(col, col, col, alpha);
}
Fragment Shader: shd_1BitDithering at line 31 : ''
this shader works perfecty in shadertoy and shader editor tool (a very good software on steam to try shaders)
I'm going to try it also on my phone (there is another shader tool, that is an app where I learned a lot on shaders)
seems to be here there is not a compile error
because the shader works in other places but here it doesn't want that if
it says error on lne 31 but the problem is on the whole if
if I delete it the shader works (but obviously is all black)
what can I do to solve this problem?
thank you so much
Last edited: