So for reference, the sampler is called "predicationSampler" and you can get a texture out of it by calling tex2D, like this: tex2D(predicationSampler, texcoord);
Doing that returns a texture that looks like this:
float3 depth = tex2D(predicationSampler, texcoord).rrr * 256;
float3 sobel(sampler tex, float2 tex_coord)
{
float3 t = tex2D(tex, float2(tex_coord.x, tex_coord.y + INV_H)).rgb;
float3 b = tex2D(tex, float2(tex_coord.x, tex_coord.y - INV_H)).rgb;
float3 l = tex2D(tex, float2(tex_coord.x - INV_W, tex_coord.y)).rgb;
float3 r = tex2D(tex, float2(tex_coord.x + INV_W, tex_coord.y)).rgb;
float3 tl = tex2D(tex, float2(tex_coord.x - INV_W, tex_coord.y + INV_H)).rgb;
float3 tr = tex2D(tex, float2(tex_coord.x + INV_W, tex_coord.y + INV_H)).rgb;
float3 bl = tex2D(tex, float2(tex_coord.x - INV_W, tex_coord.y - INV_H)).rgb;
float3 br = tex2D(tex, float2(tex_coord.x + INV_W, tex_coord.y - INV_H)).rgb;
float3 sx = -tl - 2 * l - bl + tr + 2 * r + br;
float3 sy = -tl - 2 * t - tr + bl + 2 * b + br;
float3 returnCol = sqrt(sx * sx + sy * sy);
return returnCol;
}
// ...
return sobel(predicationSampler, texcoord).rrr * 256;
We could do a threshold pass on it to remove it but I quite like the dim lines, so let's proceed with this and hope it's imperceptible.
So, let's multiply this by the original output image.
I have come to reason that the speckles are there because they bits of geometry on the other side of Sekiro. So are those triangles not culled? I should investigate further, but for now, I think the effect is acceptable.