I'm using a Sobel filter to draw an outline in a shader. How do I control its thickness? Here's my outlining code:
float3x3 Kx = {
-1, 0, 1,
-2, 0, 2,
-1, 0, 1};
float3x3 Ky = {
1, 2, 1,
0, 0, 0,
-1,-2,-1};
float Lx = 0;
float Ly = 0;
for (int y = -1; y <= 1; ++y) {
for (int x = -1; x<= 1; ++x) {
float2 offset = float2( x, y );
float3 tex = tex2D(sampler, uv + offset).rgb;
float luminance = dot(tex, float3(0.3, 0.59, 0.11));
Lx += luminance * Kx[y+1][x+1];
Ly += luminance * Ky[y+1][x+1];
}
}
float color = sqrt(Lx*Lx + Ly*Ly);
return float4( color, color, color, color );