Index: data/Media/materials/scripts/asteroids.material
===================================================================
--- data/Media/materials/scripts/asteroids.material	(revision 5120)
+++ data/Media/materials/scripts/asteroids.material	(revision 5121)
@@ -1,25 +1,230 @@
-material rock/TEXFACE/rock.tga
-{
-	receive_shadows on
+
+//--------------
+// Bump mapping
+//--------------
+
+// Bump map vertex program, support for this is required
+vertex_program BumpMapVP cg
+{
+	source BumpMapping.cg
+	entry_point main_vp
+	profiles vs_1_1 arbvp1
+}
+
+// Bump map fragment program, support for this is optional
+fragment_program BumpMapFP cg
+{
+	source BumpMapping.cg
+	entry_point main_fp
+	profiles ps_1_1 arbfp1 fp20
+}
+
+// Bump map with specular vertex program, support for this is required
+vertex_program BumpMapVPSpecular cg
+{
+	source BumpMapping.cg
+	entry_point specular_vp
+	profiles vs_1_1 arbvp1
+}
+
+// Bump map fragment program, support for this is optional
+fragment_program BumpMapFPSpecular cg
+{
+	source BumpMapping.cg
+	entry_point specular_fp
+	profiles ps_1_1 arbfp1 fp20
+
+	default_params
+	{
+        param_named shine float 3
+	}
+
+}
+
+
+// Any number of lights, diffuse and specular
+material Asteroid/BumpMap/MultiLightSpecular
+{
+
+	// This is the preferred technique which uses both vertex and
+	// fragment programs, supports coloured lights
 	technique
 	{
-		pass
-		{
-			ambient 0.500000 0.500000 0.500000 1.000000
-			diffuse 0.800000 0.800000 0.800000 1.000000
-			emissive 0.000000 0.000000 0.000000 1.000000
+		// Base ambient pass
+		pass
+		{
+			// 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
+			// Really basic vertex program
+			// NB we don't use fixed function here because GL does not like
+			// mixing fixed function and vertex programs, depth fighting can
+			// be an issue
+			vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
+			{
+				param_named_auto worldViewProj worldviewproj_matrix
+				param_named_auto ambient ambient_light_colour
+			}
+
+		}
+		// Now do the lighting pass
+		// NB we don't do decal texture here because this is repeated per light
+		pass
+		{
+			// base colours, not needed for rendering, but as information
+			// to lighting pass categorisation routine
+			ambient 0 0 0
+			// do this for each light
+			iteration once_per_light
+
+
+			scene_blend add
+
+			// Vertex program reference
+			vertex_program_ref BumpMapVPSpecular
+			{
+				param_named_auto lightPosition light_position_object_space 0
+				param_named_auto eyePosition camera_position_object_space
+				param_named_auto worldViewProj worldviewproj_matrix
+			}
+
+			// Fragment program
+			fragment_program_ref BumpMapFPSpecular
+			{
+				param_named_auto lightDiffuse light_diffuse_colour 0
+				param_named_auto lightSpecular light_specular_colour 0
+			}
+
+			// Base bump map
+			texture_unit
+			{
+				texture NMrock.tga
+				colour_op replace
+			}
+			// Normalisation cube map
+			texture_unit
+			{
+				cubic_texture nm.tga combinedUVW
+				tex_coord_set 1
+				tex_address_mode clamp
+			}
+			// Normalisation cube map #2
+			texture_unit
+			{
+				cubic_texture nm.tga combinedUVW
+				tex_coord_set 2
+				tex_address_mode clamp
+			}
+		}
+
+		// Decal pass
+		pass
+		{
+			lighting off
+			// Really basic vertex program
+			// NB we don't use fixed function here because GL does not like
+			// mixing fixed function and vertex programs, depth fighting can
+			// be an issue
+			vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
+			{
+				param_named_auto worldViewProj worldviewproj_matrix
+				param_named ambient float4 1 1 1 1
+			}
+			scene_blend dest_colour zero
 			texture_unit
 			{
 				texture rock.tga
-				colour_op modulate
-			}
-		}
-		pass
-		{
-			ambient 0.0 0.0 0.0
-			diffuse 0.0 0.0 0.0
-			specular 0.000000 0.000000 0.000000 1.000000 12.500000
+			}
+
+		}
+	}
+
+	// This is the fallback which cards which don't have fragment program
+	// support will use, NB does not support specular colour
+	// Note that it still requires vertex program support
+	technique
+	{
+		// Base ambient pass
+		pass
+		{
+			// 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
+			// Really basic vertex program
+			// NB we don't use fixed function here because GL does not like
+			// mixing fixed function and vertex programs, depth fighting can
+			// be an issue
+			vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
+			{
+				param_named_auto worldViewProj worldviewproj_matrix
+				param_named_auto ambient ambient_light_colour
+			}
+
+		}
+		// Now do the lighting pass
+		// NB we don't do decal texture here because this is repeated per light
+		pass
+		{
+			// base colours, not needed for rendering, but as information
+			// to lighting pass categorisation routine
+			ambient 0 0 0
+			// do this for each light
+			iteration once_per_light
+
+
 			scene_blend add
-		}
+
+			// Vertex program reference
+			vertex_program_ref BumpMapVP
+			{
+				param_named_auto lightPosition light_position_object_space 0
+				param_named_auto worldViewProj worldviewproj_matrix
+			}
+
+			// Base bump map
+			texture_unit
+			{
+				texture NMrock.tga
+				colour_op replace
+			}
+			// Normalisation cube map, with dot product on bump map
+			texture_unit
+			{
+				cubic_texture nm.tga combinedUVW
+				tex_coord_set 1
+				tex_address_mode clamp
+				colour_op_ex dotproduct src_texture src_current
+				colour_op_multipass_fallback dest_colour zero
+			}
+		}
+
+		// Decal pass
+		pass
+		{
+			lighting off
+			// Really basic vertex program
+			// NB we don't use fixed function here because GL does not like
+			// mixing fixed function and vertex programs, depth fighting can
+			// be an issue
+			vertex_program_ref Ogre/BasicVertexPrograms/AmbientOneTexture
+			{
+				param_named_auto worldViewProj worldviewproj_matrix
+				param_named ambient float4 1 1 1 1
+			}
+			scene_blend dest_colour zero
+			texture_unit
+			{
+				texture rock.tga
+			}
+
+		}
+
 	}
 }
+
+
+
