Eyeon:Script/Reference/Applications/Fuse/Classes/ViewShader/ViewShader

From VFXPedia

Jump to: navigation, search

Contents


Summary

ViewShader objects are constructed by passing them a name string, and a Cg shader string. The name passed should be the name of the structure derived from the ViewShader baseclass.

This is typically done within the ScriptViewShader:SetupShader() function.


Usage

vs = ViewShader(string name, string shader)

name (string, required)

The name of the structure derived from ViewShader within the shader string.

shader (string, required)

A Cg shader string defining a subclass of ViewShader, and implementing the ShadePixel() member.


Returns

Returns a constructed ViewShader object.


Example

This example fetches a shaded pixel from the source and applies a simple gamma.

-- Here's the Cg shader itself:
shaderstring = 
[[
struct GammaFuse : ViewShader
{
    ViewShader source;	                        // need this line
    float gamma;                                // run-time parameter
 
    void ShadePixel(inout FuPixel f)            // must implement this method
    {
        source.ShadePixel(f);                   // get source pixel
 
        f.Color.rgb = pow(f.Color.rgb, gamma);  // apply simple gamma
    }
};
]]
 
 
local vs = ViewShader("GammaFuse", shaderstring)


See Also


Tips for ViewShader (edit)

EyeonTips:Script/Reference/Applications/Fuse/Classes/ViewShader/ViewShader