Options
All
  • Public
  • Public/Protected
  • All
Menu

Module "tex/blur"

Index

Variables

Functions

Variables

Const blur13

blur13: TaggedFn4<"sampler2D", "vec2", "vec2", "vec2", "vec4"> = defn("vec4","blur13",["sampler2D", "vec2", "vec2", "vec2"],(tex, res, uv, dir) => {let col: Vec4Sym;let off: Vec2Sym;let off2: Vec2Sym;let off3: Vec2Sym;let delta: Vec2Sym;const k1 = 0.2969069646728344;const k2 = 0.09447039785044732;const k3 = 0.010381362401148057;return [(delta = sym(div(dir, res))),(off = sym(mul(delta, 1.411764705882353))),(off2 = sym(mul(delta, 3.2941176470588234))),(off3 = sym(mul(delta, 5.176470588235294))),(col = sym(mul(texture(tex, uv), 0.1964825501511404))),singlePass(col, tex, uv, off, k1),singlePass(col, tex, uv, off2, k2),singlePass(col, tex, uv, off3, k3),ret(col),];})

13x13 gaussian blur texture lookup, optimized, but based on:

param

sampler2D

param

resolution

param

-

param

blur pass direction (vec2(1,0) or vec2(0,1))

Const blur5

blur5: TaggedFn4<"sampler2D", "vec2", "vec2", "vec2", "vec4"> = defn("vec4","blur5",["sampler2D", "vec2", "vec2", "vec2"],(tex, res, uv, dir) => {let col: Vec4Sym;let off: Vec2Sym;const k1 = 0.29411764705882354;const k2 = 0.35294117647058826;return [(off = sym(div(mul(vec2(1 + 1 / 3), dir), res))),(col = sym(mul(texture(tex, uv), k1))),singlePass(col, tex, uv, off, k2),ret(col),];})

5x5 gaussian blur texture lookup, optimized, but based on:

param

sampler2D

param

resolution

param

-

param

blur pass direction (vec2(1,0) or vec2(0,1))

Const blur9

blur9: TaggedFn4<"sampler2D", "vec2", "vec2", "vec2", "vec4"> = defn("vec4","blur9",["sampler2D", "vec2", "vec2", "vec2"],(tex, res, uv, dir) => {let col: Vec4Sym;let off: Vec2Sym;let off2: Vec2Sym;let delta: Vec2Sym;const k1 = 0.3162162162;const k2 = 0.0702702703;return [(delta = sym(div(dir, res))),(off = sym(mul(delta, 1.3846153846))),(off2 = sym(mul(delta, 3.2307692308))),(col = sym(mul(texture(tex, uv), 0.227027027))),singlePass(col, tex, uv, off, k1),singlePass(col, tex, uv, off2, k2),ret(col),];})

9x9 gaussian blur texture lookup, optimized, but based on:

param

sampler2D

param

resolution

param

-

param

blur pass direction (vec2(1,0) or vec2(0,1))

Functions

Const singlePass

  • singlePass(col: Vec4Sym, tex: Sampler2DSym, uv: Vec2Sym, off: Vec2Sym, k: number): Assign<"vec4">
  • Inline function. Computes single blur step for given +/- offset & weight.

    Parameters

    • col: Vec4Sym

      -

    • tex: Sampler2DSym

      -

    • uv: Vec2Sym

      -

    • off: Vec2Sym

      -

    • k: number

      -

    Returns Assign<"vec4">

Generated using TypeDoc