goofi v3.0.0

Level

brightness, contrast and gamma

Gain scales, offset shifts, gamma curves, and invert flips what comes out. Alpha is left alone.

Level wgsl
input
out
Type name
graphics:Level
Plane
graphics
Tags
imagetransform
Language
wgsl
Tier
shader
Bundle
graphics
Source
node-bundles/graphics/Level.wgsl
Availability
available

Slots

SlotDirectionType
inputinputTEXTURE
outoutputTEXTURE

Parameters

level

NameTypeDefaultRangeDoc
gainfloat10 … 4
offsetfloat0-1 … 1
gammafloat10.1 … 4
invertboolfalse

common

NameTypeDefaultRangeDoc
widthint00 … 8192Texture size in pixels; 0 follows the first wired texture input. A node that makes its own frames follows the patch's default instead.
heightint00 … 8192Texture size in pixels; 0 follows the first wired texture input. A node that makes its own frames follows the patch's default instead.

Source

The current source of this node, as it stands in the goofi repository at node-bundles/graphics/Level.wgsl.

node-bundles/graphics/Level.wgsl
/* goofi
{ "doc": "brightness, contrast and gamma\nGain scales, offset shifts, gamma curves, and invert flips what comes out. Alpha is left alone.",
  "tags": ["image", "transform"],
  "inputs": [{"name": "input", "kind": "TEXTURE"}],
  "params": [
    {"group": "level", "name": "gain", "kind": "float", "default": 1.0, "min": 0.0, "max": 4.0},
    {"group": "level", "name": "offset", "kind": "float", "default": 0.0, "min": -1.0, "max": 1.0},
    {"group": "level", "name": "gamma", "kind": "float", "default": 1.0, "min": 0.1, "max": 4.0},
    {"group": "level", "name": "invert", "kind": "bool", "default": false} ] }
*/
fn shade(uv: vec2f) -> vec4f {
    let c = textureSample(input, samp, uv);
    var rgb = pow(max(c.rgb * p.gain + p.offset, vec3f(0.0)), vec3f(1.0 / p.gamma));
    if (p.invert != 0u) {
        rgb = 1.0 - rgb;
    }
    return vec4f(rgb, c.a);
}

← All nodes