Software Dithering

Post a reply

Smilies
:D :) :( :o :shock: :? 8-) :lol: :x :P :oops: :cry: :evil: :twisted: :roll: :wink: :geek: :ugeek: :!: :?: :idea: :arrow: :| :mrgreen: :3: :wub: >:( :blergh:
View more smilies

BBCode is ON
[img] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Software Dithering

Re: Software Dithering

by Okgo5555 » Sat Apr 13, 2024 5:46 pm

Understood, but i was proposing an approach that could even be a toggled feature simply with additive assets and zscript actors into the .pk3 ala decals. No big deal. I can cook it up myself. Just something that might be "nice to have" for software render nerds.

Re: Software Dithering

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;
}

Software Dithering

by Okgo5555 » Thu Apr 11, 2024 4:12 pm

Would it be possible to write in a software rendered checkerboard dither as a replacement for translucency and alpha blending? This would be more performant and provide a more "vanilla" approach to something like rendering a translucent fireball. This absolutely can be achieved via Zscript and DECORATE.

However, this is not a a native feature.

You could simply alternate every other pixel and every other frame for a given sprite to make a 1994, software "translucent" fireball. Curently, to achive this, the user would need to manually create dithered frames for any assets for this effect.

It seems like it would be a reasonable option... even if its just added to the gzdoom.pk3 🤷‍♂️

Top