Is there a DX11 version of "Dots (EX9.Texture Filter)"?

I’m playing with some LED screens and I’m trying to make a nice previz of the result, but my current patch is oldschool DX9.

The Dots shader is super short and concise, I wonder if a DX11 version exists ?

Thanks !

Hey Joanie,

There you go :

//@author:
//@help: dots dx11 port
//@tags: dots, texture
//@credits: unc

Texture2D texture2d : PREVIOUS;
float2 res : TARGETSIZE;
int2 pixel_size <string uiname = "Pixel Size";> = float2(32, 32);
bool alpha <string uiname = "Alpha";> = false;
bool points <string uiname = "Point";> = false;
float smooth <string uiname = "Smooth"; float uimin = 0; float uimax = 1;>;
float2 scale <string uiname = "Scale"; float uimin = 1; float uimax = 10;> = float2(1, 1);

SamplerState linearSampler : IMMUTABLE
{
    Filter = MIN_MAG_MIP_LINEAR;
    AddressU = Clamp;
    AddressV = Clamp;
};

float mx(float3 p)
{
	return max(p.x, max(p.y, p.z));
}

struct psInput
{
	float4 p : SV_Position;
	float2 uv : TEXCOORD0;
};


float4 PS(psInput input) : SV_Target
{
	float2 vp = input.uv * res - .25;
	float2 sz = min(max(0.5/res, pixel_size), res);
	float4 col = texture2d.Sample(linearSampler, floor(vp/sz)*sz/res+.5/res);
	float glow = length((frac(vp/sz)-.5)/scale);
	float grey = mx(col.rgb);
	
	if(points)
	{
		grey = 1;
	}
	
	float circ = smoothstep(.48, .47 * saturate(1 - smooth) * min(1, 1 - fwidth(glow) * 1.6 * saturate(pixel_size * .5)), glow/grey);
	col.rgb = col.rgb/grey*circ;
	if(alpha)
	{
		col.a *= circ;
	}
	
	return col;
}

technique10 Process
{
	pass P0
	{
		SetPixelShader(CompileShader(ps_4_0,PS()));
	}
}
3 Likes

Wow, that was quick and efficient, thank you so much @sebescudie !!!

J’ai peut-être une autre mini mission freelance, je peux te faire un DM / mail ? ;)

you’re welcome!

will ping you :]

1 Like