// Offset mapping options: // texture: defaults to material_name.png. // This specifies which texture (in the form of a file such as wall.png) will be // applied to the material. // // offset_map: defaults to texture_filename_normals.texture_extension // (example :texture => "wall.png" offset_map will be "wall_normals.png") // The normal map (defined in tangent space) for the object( to simulate detail ). // // generate_tangents: defaults to true. // This will generate the tangents for the loaded mesh, but if you do not move the // mesh throughout the scene, there is no need. // <% @texture ||= "#{name}.png" %> <% tangent_space = @generate_tangents %> <% tangent_space = true if @generate_tangents.nil? %> <% @offset_map ||= "#{texture.split('.')[0]}_normals.#{texture.split('.')[1]}"%> material <%= name %> { // This is the preferred technique which uses both vertex and // fragment programs, supports coloured lights technique { // do the lighting and bump mapping with parallax pass // NB we don't do decal texture here because this is repeated per light pass { // Vertex program reference vertex_program_ref OffsetMappingVP { 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 OffsetMappingFP { param_named_auto lightDiffuse light_diffuse_colour 0 param_named_auto lightSpecular light_specular_colour 0 // Parallax Height scale and bias param_named scaleBias float4 0.04 -0.02 1 0 } // Normal + height(alpha) map texture_unit { texture <%= offset_map %> } // Base diffuse texture map texture_unit { texture <%= texture %> } } } // This is the preferred technique which uses both vertex and // fragment programs, supports coloured lights technique { // do the lighting and bump mapping with parallax pass // NB we don't do decal texture here because this is repeated per light pass { // Vertex program reference vertex_program_ref OffsetMappingVP { 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 OffsetMappingPS { param_indexed_auto 0 light_diffuse_colour 0 param_indexed_auto 1 light_specular_colour 0 // Parallax Height scale and bias param_indexed 2 float4 0.04 -0.02 1 0 } // Normal + height(alpha) map texture_unit { texture <%= offset_map %> } // Base diffuse texture map texture_unit { texture <%= texture %> } } } // Simple no-shader fallback technique { pass { // Base diffuse texture map texture_unit { texture <%= texture %> } } } }