public Vec4 Blur5(Sampler2D image, Vec2 uv, Vec2 resolution, Vec2 direction) { var color = new Vec4(0.0f, 0.0f, 0.0f, 0.0f); var off1 = new Vec2(1.3333333333333333f) * direction; color += image.Sample(uv) * 0.29411764705882354f; color += image.Sample(uv + (off1 / resolution)) * 0.35294117647058826f; color += image.Sample(uv - (off1 / resolution)) * 0.35294117647058826f; return(color); }
public Vec3 ApplyKernel(Vec3 color, float offset, float[] kernel) { var offsets = CreateOffsets(offset); for (int i = 0; i < kernel.Length; ++i) { Set(color, color + Texture.Sample(UV + new Vec2(offsets[i].X, offsets[i].Y)).XYZ *kernel[i]); } return(color); }
public Vec4 Blur9(Sampler2D image, Vec2 uv, Vec2 resolution, Vec2 direction) { var color = new Vec4(0.0f, 0.0f, 0.0f, 0.0f); var off1 = new Vec2(1.3846153846f) * direction; var off2 = new Vec2(3.2307692308f) * direction; color += image.Sample(uv) * 0.2270270270f; color += image.Sample(uv + (off1 / resolution)) * 0.3162162162f; color += image.Sample(uv - (off1 / resolution)) * 0.3162162162f; color += image.Sample(uv + (off2 / resolution)) * 0.0702702703f; color += image.Sample(uv - (off2 / resolution)) * 0.0702702703f; return(color); }