by Cherno » Thu Apr 11, 2024 10:46 pm
Not for the software renderer as such, but you can use a shader like the one I wrote a short while ago:
Code: Select all
vec4 Process(vec4 color)
{
//Thanks to arookas for the help
mat4 thresholdMatrix =
{ vec4(1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0),
vec4(13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0),
vec4(4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0),
vec4(16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0)
};
vec2 texCoord = gl_TexCoord[0].st;
vec4 texel = getTexel(texCoord);
ivec2 fragCoord = ivec2(gl_FragCoord.xy);
if (texel.a < thresholdMatrix[int(fragCoord.x) % 4][int(fragCoord.y) % 4])
{
discard;
}
return texel * color;
}
Not for the software renderer as such, but you can use a shader like the one I wrote a short while ago:
[code]vec4 Process(vec4 color)
{
//Thanks to arookas for the help
mat4 thresholdMatrix =
{ vec4(1.0 / 17.0, 9.0 / 17.0, 3.0 / 17.0, 11.0 / 17.0),
vec4(13.0 / 17.0, 5.0 / 17.0, 15.0 / 17.0, 7.0 / 17.0),
vec4(4.0 / 17.0, 12.0 / 17.0, 2.0 / 17.0, 10.0 / 17.0),
vec4(16.0 / 17.0, 8.0 / 17.0, 14.0 / 17.0, 6.0 / 17.0)
};
vec2 texCoord = gl_TexCoord[0].st;
vec4 texel = getTexel(texCoord);
ivec2 fragCoord = ivec2(gl_FragCoord.xy);
if (texel.a < thresholdMatrix[int(fragCoord.x) % 4][int(fragCoord.y) % 4])
{
discard;
}
return texel * color;
}[/code]