
// RTShader System materials.

// This is a single pass per pixel lighting based material.
// All scene lights will be applied within a single rendering pass.
// It saves geometry overdraw but it consumes more instructions during vertex and pixel shaders.
// Use this method when your scene uses small amount of lights. (1-3).
material RTSS/PerPixel_SinglePass
{
	technique
	{
		pass
		{
			// Turn off specular in order to use only diffuse based bump map technique.
			specular 1.0 1.0 1.0 32
			
			texture_unit
			{
				texture Panels_Diffuse.png
			}				
			
			// RT Shader system section.
 			rtshader_system
 			{	 	
 				// Override lighting stage with per pixel lighting. 			
 				lighting_stage per_pixel				
 			}			
		}				
	}
}

// This is a single pass normal map lighting based material.
// All scene lights will be applied within a single rendering pass.
// Supports all kind of lights - directional, point and spot.
// It saves geometry overdraw but it consumes more instructions during vertex and pixel shaders.
// Use this method when your scene uses small amount of lights. (1-3).
material RTSS/NormalMapping_SinglePass
{
	technique
	{
		pass
		{
			// Comment the specular in order to use only diffuse based normal map technique.
			specular 1.0 1.0 1.0 32
			
			texture_unit
			{
				texture Panels_Diffuse.png
			}				
			
			// RT Shader system section.
 			rtshader_system
 			{	 	
 				// Override lighting stage with normal map lighting.
 				lighting_stage normal_map Panels_Normal_Tangent.png tangent_space 0 bilinear 1 -1.0
 			}			
		}				
	}
}

// This is a multi pass normal map lighting based material.
// It acts as any other multi light material.
// This material defined to use only one type of light per lighting pass because the RTSS need to
// know what code to produce for the iterative lighting pass, otherwise it will throw an exception.
// It support any number of lights drawing but it uses more geometry drawing. 
// Use this method when your scene uses large amount of lights. (3-8).
material RTSS/NormalMapping_MultiPass
{
	technique
	{
		// Base ambient pass
		pass ambient
		{
			// base colours, not needed for rendering, but as information
			// to lighting pass categorisation routine
			ambient 1 1 1
			diffuse 0 0 0 
			specular 0 0 0 0 
			
			// RT Shader system section.			
 			rtshader_system
 			{	
 				// Override dynamic light count with zero light count.
 				// Doing this will cause the RTSS to create 
 				// ambient lighting shaders.
 				// If not doing that the RTSS it will use the current scene light count
 				// which will result in full lighting calculation in this pass.
				light_count 0 0 0
			}
		}
		
		// Lighting pass.
		pass lighting
		{
			// Comment the specular in order to use only diffuse based normal map technique.
			specular 1.0 1.0 1.0 32
			
			// base colours, not needed for rendering, but as information
			// to lighting pass categorisation routine
			ambient 0 0 0 
			
			// do this for each point light
			// You MUST specify the light type when working with the RT Shader System in iterative lighting method. 
			// otherwise an exception will be thrown.
			iteration once_per_light point

			scene_blend add		
			
			// RT Shader system section.
 			rtshader_system
 			{	 	
 				// Override lighting stage with normal map lighting.
 				lighting_stage normal_map Panels_Normal_Tangent.png tangent_space 0	bilinear 1 -1.0
 			}			
		}	
		
		// Decal pass
		pass decal
		{
			
			lighting off
			
			scene_blend dest_colour zero
			texture_unit decalmap
			{
				texture Panels_Diffuse.png
			}			
		}			
	}
}

// Athene single multi pass material override.
material RTSS/Athene/NormalMapping_SinglePass : RTSS/NormalMapping_SinglePass
{	
	technique
	{			
		pass
		{	
			// Override the diffuse map.
			texture_unit
			{
				texture egyptrockyfull.jpg 
			}	
										
			// Override the normal map.
 			rtshader_system
 			{	 	 						
 				lighting_stage normal_map atheneNormalMap.png tangent_space 0 bilinear 1 -1.0	
 			}
		}				
	}
}

// Athene model multi pass material override.
material RTSS/Athene/NormalMapping_MultiPass : RTSS/NormalMapping_MultiPass
{	
	technique
	{
		pass lighting
		{								
			// Override the normal map.
 			rtshader_system
 			{	 	 						
 				lighting_stage normal_map atheneNormalMap.png tangent_space 0 bilinear 1 -1.0
 			}
		}
		
		// Decal pass
		pass decal
		{
			// Override the decal map.
			texture_unit decalmap
			{
				texture egyptrockyfull.jpg 
			}			
		}
	}
}

// This material derive from the multi pass normal map material.
// The only difference is that it process 2 point lights at each lighting pass.
material RTSS/NormalMapping_MultiPass_2lights : RTSS/NormalMapping_MultiPass
{
	technique
	{		
		pass lighting
		{
			// Override light iteration definition.
			iteration 1 per_n_lights 2 point										
		}							
	}
}
		
// This material demonstrates the texture blending extension.
material RTSS/LayeredBlending
{
	technique
	{
		pass
		{		
			lighting off	
			texture_unit
			{
				scale 0.1 0.1
				texture rockwall.tga
			}

			texture_unit
			{
				// RT Shader system section - required by the layered blend extension.
				rtshader_system
				{
					layered_blend luminosity
					source_modifier src1_inverse_modulate custom 2
				}
				texture ogrelogo.png
			}						
		}
	}
}

