< Previous | Contents | Next >

Returns

The function should return a freshly-created ViewShader object.

Example


-- Here’s the GLSL shader itself:

-- params for the shader:

params = [[

float Gamma // enable switches (0 or 1), one per line float Alphagamma

]]


shader = [[

void ShadePixel(inout FuPixel f)

{

// get source pixel EvalShadePixel(f);


// apply Gamma

vec4 gamma = vec4(Gamma, Gamma, Gamma, Alphagamma); f.Color = sign(f.Color) * pow(abs(f.Color), gamma);

}

]]


-- This is called when the shader is created

-- img may be nil

function SetupShadeNode(group, req, img)

-- pass group, name, params string, and shader source return ViewShadeNode(group, "GammaFuse", params, shader)

end