I just came across the same article, and found it tremendously useful as well. The formula to calculate the weights and offsets is given in it:
(source: rastergrid.com)
The author arrived at the weights by using the 12th row in the pascal triangle. So for example the second offset is calculated by:
1.3846153846 = (1 * 792 + 2 * 495) / (792 + 495)
The second weight is calculated by:
0.1945945946 = (792 + 495) / 4070
I'm not sure what you mean by calculating the offsets given uniform weight variables but if it's of help I've included a C++ program at the end of this post that outputs the offsets and weights for an arbitrary row in the pascal triangle.
If I understand your question about non hardcoded offsets, then you want to be able to calculate the offsets on the fly in GLSL? You could do that by porting the program below, but you'll still need to hardcode the binomial coefficients, or calculate those on the fly as well. However, that will be expensive since it will have to be done for every pixel. I think a better alternative is to precalculate the offsets and weights in C (or whatever programming language you're using), and then bind them to a uniform array value in GLSL. Here's the GLSL snippet for what I mean:
uniform float offset[5];
uniform float weight[5];"
uniform int numOffsets;
You'll want to replace "5" with the maximum number of offsets/weights you plan to use, and set numOffsets to the number you're using for a particular operation.
Here's the program that outputs the weights and offsets. "coeffs" should be replaced with the binomial coefficients of the row you want in the pascal table. The one included here is from the 22nd row
#include <iostream>
#include <vector>
using namespace std;
int main(int argc, char* argv[])
{
float coeffs[] = { 705432, 646646, 497420, 319770, 170544, 74613, 26334, 7315, 1540, 231 };
double total = coeffs[0];
for (int i = 1; i < sizeof(coeffs) / sizeof(float); i++)
{
total += 2 * coeffs[i];
}
vector<float> offsets;
vector<float> weights;
offsets.push_back(0);
weights.push_back(coeffs[0] / total);
for (int i = 1; i <= (sizeof(coeffs) / sizeof(float) - 1) / 2; i++)
{
int index = (i - 1) * 2 + 1;
float weight = coeffs[index] + coeffs[index + 1];
offsets.push_back((coeffs[index] * index + coeffs[index + 1] * (index + 1)) / weight);
weights.push_back(weight / total);
}
for (int i = 0; i < offsets.size(); i++)
{
cout << offsets[i] << ", ";
}
cout << "\n";
for (int i = 0; i < weights.size(); i++)
{
cout << weights[i] << ", ";
}
cout << "\n";
}