# Depth aware blur - Kawase

I am using this Kawase Blur, to apply blur onto my buffer. But I would like to apply this blur in an uniform way, no matter the distance of the objects from the camera.

I guess that I need to use the depth buffer but how should I change the offset according to depth ?

// offset : From 0 to number of pass
float o = 0;
o += tex2D(tex, coord + (float2( offset + 0.5,  offset + 0.5) * texelSize)) * 0.25;
o += tex2D(tex, coord + (float2(-offset - 0.5,  offset + 0.5) * texelSize)) * 0.25;
o += tex2D(tex, coord + (float2(-offset - 0.5, -offset - 0.5) * texelSize)) * 0.25;
o += tex2D(tex, coord + (float2( offset + 0.5, -offset - 0.5) * texelSize)) * 0.25;

• basically, you should divide the offset by the depth of the current fragment. this is akin to the transform that geometry goes through during perspective projection – Sebastián Mestre Dec 27 '17 at 3:32