Eyeon:Script/Reference/Applications/Fuse/Classes/ViewShader/ShadePixel
From VFXPedia
Contents |
Summary
The ShadePixel function is executed by the GPU for every drawn pixel. A FuPixel is passed as the argument, and changes made to this FuPixel are passed on to the next shader in the chain.
The FuPixel passed in has valid TexCoord members, but not Color. The TexCoord members may be modified if desired, before the source pixel is fetched, to vary the source location. Note: when modifying a TexCoord member, the other TexCoord members should also be updated with corresponding values.
The pixel color should be fetched by calling the ShadePixel() function of the 'source' ViewShader member. This propagates up the chain of shaders, which may further modify the coordinates, until the original pixel color values are fetched from the source image. Each shader in the chain can then modify these colors, and the resulting FuPixel is passed back down to the next shader in turn.
Usage
ShadePixel(inout FuPixel f)
- f (FuPixel, required)
- FuPixel struct used to supply and receive the current pixel
Returns
No explicit returns. This function modifies the FuPixel that is passed to it.
Example
This example fetches a shaded pixel from the source and applies a simple gamma.
function GammaFuse : ViewShader { ViewShader source; // used to fetch the source pixel float gamma; // user-set run-time parameter void ShadePixel(inout FuPixel f) // required ShadePixel() function { source.ShadePixel(f); // get source pixel f.Color.rgb = pow(f.Color.rgb, gamma); // apply gamma to RGB channels only } }
Tips for ShadePixel (edit)
EyeonTips:Script/Reference/Applications/Fuse/Classes/ViewShader/ShadePixel