|
Documentation
Dolphin-emu's post-processing shaders are written in Cg (or C for Graphics) and are used to modify the output of each frame after all other visual changes, right before it is displayed on screen. They make changes one pixel at a time. Knowledge of C Programming Language is required. If you don't know C, you should look for a tutorial or check out the wikipedia article. Simple Shader Example: uniform samplerRECT samp0 : register(s0);
void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0)
{
float4 c0 = texRECT(samp0, uv0).rgba; // creates a variable representing a pixel and is set to the input color data
ocol0 = float4(c0.r, c0.g, c0.b, c0.a); // set the output color to the value of c0
}The shader's entry point is void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0), the code inside of main is executed on the GPU per pixel render. The parameter list of main()
Main() is called on the GPU and passes in the UV Mapping data into uv0 variable, while setting the ocol0 variable will set the resulting pixel color after the shader is done executing. Variable Types
Global Variables
So if you want to remove red colors from the rendered graphics, you do it like this: uniform samplerRECT samp0 : register(s0);
void main(out float4 ocol0 : COLOR0, in float2 uv0 : TEXCOORD0)
{
float4 c0 = texRECT(samp0, uv0).rgba; // creates a variable representing a pixel and is set to the input color data
ocol0 = float4(0.0, c0.g, c0.b, c0.a); // set the output color to the value of c0, but make red always 0
}Notes:
|