Eyeon:Script/Reference/Applications/Fuse/ViewShader/Events/SetupParams
From VFXPedia
ViewShader Reference Manual > SetupParams
Event Function
Contents |
Summary
The SetupParams event is called every time the screen is redrawn. This allows the fuse to pass any run-time parameters to the shader.
Parameters containing the current control values can be extracted from the passed Request. These values can be used to set the shader's run-time parameters in the passed ViewShader with the SetParam() function.
Usage
SetupParams(object request, object vs, object image)
Arguments
request (Request object)
- A Request object containing the current control values.
vs (ViewShader object)
- The ViewShader object created and returned by SetupShader()
image (Image object)
- The source image that will be given to the shader
Returns
The function should return true, if successful. Returning false will cause the shader chain to be rebuilt, and FreeShader() then SetupShader() will be called again. If SetupShader() also returns nil, the ScriptViewShader will be bypassed completely until the user re-enables it.
Examples
-- This is called every display refresh -- img may be nil function SetupParams(req, vs, img) local gamma = InGamma:GetValue(req).Value; -- retrieve our current control value if gamma ~= 0.0 then gamma = 1.0 / gamma; else gamma = 1000000.0; end vs:SetParam(gammaparam, gamma); -- use the gammaparam index we got from AddParam() return true; end
See Also
- SetupShader event
- ViewShader
- ViewShader:SetParam() function
- Request
- Parameter.
- Image.