|  
         
          The files containing the shaders can be found in the media directory 
            of the SDK. However, they look like this: 
             
              | D3D9.HLSL |   
              | 
// part of the Irrlicht Engine Shader example.
// These simple Direct3D9 pixel and vertex shaders will be loaded by the shaders
// example. Please note that these example shaders don't do anything really useful. 
// They only demonstrate that shaders can be used in Irrlicht.
//-----------------------------------------------------------------------------
// Global variables
//-----------------------------------------------------------------------------
float4x4 mWorldViewProj;  // World * View * Projection transformation
float4x4 mInvWorld;       // Inverted world matrix
float4x4 mTransWorld;     // Transposed world matrix
float3 mLightPos;         // Light position
float4 mLightColor;       // Light color
// Vertex shader output structure
struct VS_OUTPUT
{
	float4 Position   : POSITION;   // vertex position 
	float4 Diffuse    : COLOR0;     // vertex diffuse color
	float2 TexCoord   : TEXCOORD0;  // tex coords
};
VS_OUTPUT vertexMain( in float4 vPosition : POSITION,
                      in float3 vNormal   : NORMAL,
                      float2 texCoord     : TEXCOORD0 )
{
	VS_OUTPUT Output;
	// transform position to clip space 
	Output.Position = mul(vPosition, mWorldViewProj);
	
	// transform normal 
	float3 normal = mul(vNormal, mInvWorld);
	
	// renormalize normal 
	normal = normalize(normal);
	
	// position in world coodinates
	float3 worldpos = mul(mTransWorld, vPosition);
	
	// calculate light vector, vtxpos - lightpos
	float3 lightVector = worldpos - mLightPos;
	
	// normalize light vector 
	lightVector = normalize(lightVector);
	
	// calculate light color 
	float3 tmp = dot(-lightVector, normal);
	tmp = lit(tmp.x, tmp.y, 1.0);
	
	tmp = mLightColor * tmp.y;
	Output.Diffuse = float4(tmp.x, tmp.y, tmp.z, 0);
	Output.TexCoord = texCoord;
	
	return Output;
}
// Pixel shader output structure
struct PS_OUTPUT
{
    float4 RGBColor : COLOR0;  // Pixel color    
};
sampler2D tex0;
	
PS_OUTPUT pixelMain( float2 TexCoord : TEXCOORD0,
                     float4 Position : POSITION,
                     float4 Diffuse  : COLOR0 ) 
{ 
	PS_OUTPUT Output;
	float4 col = tex2D( tex0, TexCoord );  // sample color map
	
	// multiply with diffuse and do other senseless operations
	Output.RGBColor = Diffuse * col;
	Output.RGBColor *= 4.0;
	return Output;
} |  
             
              | D3D9.VSH |   
              | 
; part of the Irrlicht Engine Shader example.
; This Direct3D9 vertex shader will be loaded by the engine.
; Please note that these example shaders don't do anything really useful. 
; They only demonstrate that shaders can be used in Irrlicht.vs.1.1
dcl_position v0;    ; declare position
dcl_normal v1;      ; declare normal
dcl_color v2;       ; declare color
dcl_texcoord0 v3;   ; declare texture coordinate
 ; transpose and transform position to clip space 
mul r0, v0.x, c4      
mad r0, v0.y, c5, r0   
mad r0, v0.z, c6, r0   
add oPos, c7, r0       
; transform normal 
dp3 r1.x, v1, c0  
dp3 r1.y, v1, c1  
dp3 r1.z, v1, c2  
; renormalize normal 
dp3 r1.w, r1, r1  
rsq r1.w, r1.w    
mul r1, r1, r1.w  
; calculate light vector 
m4x4 r6, v0, c10      ; vertex into world position
add r2, c8, -r6       ; vtxpos - lightpos
; normalize light vector 
dp3 r2.w, r2, r2  
rsq r2.w, r2.w    
mul r2, r2, r2.w  
; calculate light color 
dp3 r3, r1, r2       ; dp3 with negative light vector 
lit r5, r3           ; clamp to zero if r3 < 0, r5 has diffuce component in r5.y
mul oD0, r5.y, c9    ; ouput diffuse color 
mov oT0, v3          ; store texture coordinates
 |  
             
              | D3D9.PSH |   
              | 
; part of the Irrlicht Engine Shader example.
; This simple Direct3D9 pixel shader will be loaded by the engine.
; Please note that these example shaders don't do anything really useful. 
; They only demonstrate that shaders can be used in Irrlicht.ps.1.1
tex t0          ; sample color map
add r0, v0, v0  ; mulitply with color
mul t0, t0, r0  ; mulitply with color
add r0, t0, t0  ; make it brighter and store result
 |  
             
              | D3D8.VSH |   
              | 
; part of the Irrlicht Engine Shader example.
; This Direct3D9 vertex shader will be loaded by the engine.
; Please note that these example shaders don't do anything really useful. 
; They only demonstrate that shaders can be used in Irrlicht.vs.1.1
; transpose and transform position to clip space 
mul r0, v0.x, c4      
mad r0, v0.y, c5, r0   
mad r0, v0.z, c6, r0   
add oPos, c7, r0       
; transform normal 
dp3 r1.x, v1, c0  
dp3 r1.y, v1, c1  
dp3 r1.z, v1, c2  
; renormalize normal 
dp3 r1.w, r1, r1  
rsq r1.w, r1.w    
mul r1, r1, r1.w  
; calculate light vector 
m4x4 r6, v0, c10      ; vertex into world position
add r2, c8, -r6       ; vtxpos - lightpos
; normalize light vector 
dp3 r2.w, r2, r2  
rsq r2.w, r2.w    
mul r2, r2, r2.w  
; calculate light color 
dp3 r3, r1, r2       ; dp3 with negative light vector 
lit r5, r3           ; clamp to zero if r3 < 0, r5 has diffuce component in r5.y
mul oD0, r5.y, c9    ; ouput diffuse color 
mov oT0, v3          ; store texture coordinates
 |  
             
              | D3D8.PSH |   
              | 
; part of the Irrlicht Engine Shader example.
; This simple Direct3D9 pixel shader will be loaded by the engine.
; Please note that these example shaders don't do anything really useful. 
; They only demonstrate that shaders can be used in Irrlicht.ps.1.1
tex t0             ; sample color map
mul_x2 t0, t0, v0  ; mulitply with color
add r0, t0, t0     ; make it brighter and store result
 |  
             
              | OPENGL.VSH |   
              | 
!!ARBvp1.0
# part of the Irrlicht Engine Shader example.
# Please note that these example shaders don't do anything really useful. 
# They only demonstrate that shaders can be used in Irrlicht.#input
ATTRIB InPos = vertex.position;
ATTRIB InColor = vertex.color;
ATTRIB InNormal = vertex.normal;
ATTRIB InTexCoord = vertex.texcoord;
#output
OUTPUT OutPos = result.position;
OUTPUT OutColor = result.color;
OUTPUT OutTexCoord = result.texcoord;
PARAM MVP[4] = { state.matrix.mvp }; # modelViewProjection matrix.
TEMP Temp;
TEMP TempColor;
TEMP TempNormal;
TEMP TempPos;
#transform position to clip space 
DP4 Temp.x, MVP[0], InPos;
DP4 Temp.y, MVP[1], InPos;
DP4 Temp.z, MVP[2], InPos;
DP4 Temp.w, MVP[3], InPos;
#transform normal
DP3 TempNormal.x, InNormal.x, program.local[0];
DP3 TempNormal.y, InNormal.y, program.local[1]; 
DP3 TempNormal.z, InNormal.z, program.local[2];
#renormalize normal
DP3 TempNormal.w, TempNormal, TempNormal;  
RSQ TempNormal.w, TempNormal.w;    
MUL TempNormal, TempNormal, TempNormal.w;
# calculate light vector 
DP4 TempPos.x, InPos, program.local[10];   # vertex into world position
DP4 TempPos.y, InPos, program.local[11];
DP4 TempPos.z, InPos, program.local[12];
DP4 TempPos.w, InPos, program.local[13];
ADD TempPos, program.local[8], -TempPos;    # vtxpos - lightpos
# normalize light vector
DP3 TempPos.w, TempPos, TempPos;  
RSQ TempPos.w, TempPos.w;    
MUL TempPos, TempPos, TempPos.w;
# calculate light color
DP3 TempColor, TempNormal, TempPos;    # dp3 with negative light vector 
LIT OutColor, TempColor;  # clamp to zero if r3 < 0, r5 has diffuce component in r5.y
MUL OutColor, TempColor.y, program.local[9]; # ouput diffuse color 
MOV OutColor.w, 1.0;          # we want alpha to be always 1
MOV OutTexCoord, InTexCoord; # store texture coordinate
MOV OutPos, Temp;
END
 |  
             
              | OPENGL.PSH |   
              | 
!!ARBfp1.0
# part of the Irrlicht Engine Shader example.
# Please note that these example shaders don't do anything really useful. 
# They only demonstrate that shaders can be used in Irrlicht.#Input
ATTRIB inTexCoord = fragment.texcoord;      # texture coordinates
ATTRIB inColor = fragment.color.primary; # interpolated diffuse color
#Output
OUTPUT outColor = result.color;
TEMP texelColor;
TEMP tmp;
TXP texelColor, inTexCoord, texture, 2D; 
ADD tmp, inColor, inColor; # mulitply with color
MUL texelColor, texelColor, tmp;  # mulitply with color   
ADD outColor, texelColor, texelColor;  # make it brighter and store result
END
 |     |