Microsoft DirectX 8.0 (C++)

Sample of an Effect File

The following shows the basic syntax and layout of a typical effect file.

//
// Sample Effect
// This effect adds two textures, using single pass or multipass technique.
//

texture tex0;
texture tex1;


// Single pass

technique t0
{
    pass p0
    {
        Texture[0] = <tex0>;
        Texture[1] = <tex1>;
        
        ColorOp[0] = SelectArg1;
        ColorArg1[0] = Texture;
        
        ColorOp[1] = Add;
        ColorArg1[0] = Texture;
        ColorArg2[0] = Current;
        
        ColorOp[2] = Disable;
    }
}

// Multipass

technique t1
{
    pass p0
    {
        Texture[0] = <tex0>;
        
        ColorOp[0] = SelectArg1;
        ColorArg1[0] = Texture;
        ColorOp[1] = Disable;  
    }
    
    pass p1
    {
        AlphaBlendEnable = True;        
        SrcBlend = One;
        DestBlend = One;
 
        Texture[0] = <tex1>;
               
        ColorOp[0] = SelectArg1;
        ColorArg1[0] = Texture;
        ColorOp[1] = Disable;  
    }
}