I've recently been looking into optimising a gaussian blur shader by using a linear sampling method instead of a discrete method.
I read a very informative article:
Efficient Gaussian Blur With Linear Sampling
In case of such a merge of two texels we have to adjust the coordinates that the distance of the determined coordinate from the texel #1 center should be equal to the weight of texel #2 divided by the sum of the two weights. In the same style, the distance of the determined coordinate from the texel #2 center should be equal to the weight of texel #1 divided by the sum of the two weights.
While I understand the logic behind this, I'm not sure how they arrived at the figures for the offset with the given weights. Would anyone be kind enough to shed more light on this for me and to also explain how, given uniform weight variables we could calculate correct offsets?
Regarding non hard coded offsets, I found another post which recommended a method of calculating the offsets, however no solution was posted for a variable amount of samples. How could I achieve that?
vec2 offsets[3];
offsets[0] = vec2(0.0, 0.0);
offsets[1] = vec2(dFdx(gl_TexCoord[0].s), dFdy(gl_TexCoord[0].t));
offsets[2] = offsets[1] + offsets[1];