⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 examples-advanced.material

📁 赫赫大名的 OGRE 游戏引擎
💻 MATERIAL
📖 第 1 页 / 共 2 页
字号:

fragment_program Examples/TexProjectionFP cg
{
	source Example_Projection.cg
	entry_point generalPurposeProjection_fp
	// sorry, ps_1_1 can't do this, fp20 can though
	profiles ps_2_0 arbfp1 fp20
}

material Examples/GeneralTexProjection
{
	technique
	{
		pass 
		{
			
			vertex_program_ref Examples/TexProjectionVP
			{
				param_named_auto worldViewProjMatrix worldviewproj_matrix
				param_named_auto worldMatrix world_matrix
				// You'll need to update the tex projection, I suggest using
				// the Frustum class
				//param_named_auto texWorldViewProj worldviewproj_matrix
			}
			fragment_program_ref Examples/TexProjectionFP
			{
				// no params
			}
			texture_unit
			{
				// Project the OGRE logo
				texture ogrelogo.jpg
				tex_address_mode clamp
			}
		}
		
			
	}
    
}

//----------------------------
// Distortion effects
//----------------------------

vertex_program Examples/FresnelRefractReflectVP cg
{
	source Example_Fresnel.cg
	entry_point main_vp
	profiles vs_1_1 arbvp1
}

fragment_program Examples/FresnelRefractReflectFP cg
{
	source Example_Fresnel.cg
	entry_point main_fp
	// sorry, ps_1_1 and fp20 can't do this
	profiles ps_2_0 arbfp1
}

fragment_program Examples/FresnelRefractReflectPS asm
{
	source Example_FresnelPS.asm
	// sorry, only for ps_1_4 :)
	syntax ps_1_4

}

material Examples/FresnelReflectionRefraction
{
	// ps_2_0 / arbfp1
	technique
	{
		pass 
		{
			
			vertex_program_ref Examples/FresnelRefractReflectVP
			{
				param_named_auto worldViewProjMatrix worldviewproj_matrix
				param_named_auto eyePosition camera_position_object_space
				param_named fresnelBias float -0.3 
				param_named fresnelScale float 1.4 
				param_named fresnelPower float 8  
				param_named_auto timeVal time 0.05
				param_named scroll float 1  
				param_named scale float 4 
				param_named noise float 1 
				// scroll and noisePos will need updating per frame
			}
			fragment_program_ref Examples/FresnelRefractReflectFP
			{
				param_named distortionRange float 0.025 
				param_named tintColour float4 0 0 0 1
			}
			// Noise
			texture_unit
			{
				// Perlin noise volume
				texture perlinvolume.dds 3d
				// min / mag filtering, no mip
				filtering linear linear none
			}
			// Reflection
			texture_unit
			{
				// Will be filled in at runtime
				texture Reflection
				tex_address_mode clamp
				// needed by ps.1.4
				tex_coord_set 1
			}
			// Refraction
			texture_unit
			{
				// Will be filled in at runtime
				texture Refraction
				tex_address_mode clamp
				// needed by ps.1.4
				tex_coord_set 2
			}
		}
		
			
	}

	// ATI 8500 +
	technique
	{
		pass
		{
			vertex_program_ref Examples/FresnelRefractReflectVP
			{
				param_named_auto worldViewProjMatrix worldviewproj_matrix
				param_named_auto eyePosition camera_position_object_space
				param_named fresnelBias float -0.3
				param_named fresnelScale float 1.4
				param_named fresnelPower float 8
				param_named_auto timeVal time 0.05
				param_named scroll float 1 
				param_named scale float 4 
				param_named noise float 1
				// scroll and noisePos will need updating per frame
			}

			// for ATI RADEON 8500 - 9200
			fragment_program_ref Examples/FresnelRefractReflectPS
			{
				// distortionRange
				param_indexed 0  float 0.025  
				// tintColour
				param_indexed 1  float4 0.05 0.12 0.15 1
			}

			// Noise
			texture_unit
			{
				// Perlin noise volume
				texture perlinvolume.dds 3d
				// min / mag filtering, no mip
				filtering linear linear none
			}
			// Reflection
			texture_unit
			{
				// Will be filled in at runtime
				texture Reflection
				tex_address_mode clamp
				// needed by ps.1.4
				tex_coord_set 1
			}
			// Refraction
			texture_unit
			{
				// Will be filled in at runtime
				texture Refraction
				tex_address_mode clamp
				// needed by ps.1.4
				tex_coord_set 2
			}
		}
	}    
}

// Normal-mapped Athene statue
material Examples/Athene/NormalMapped
{

	// This is the preferred technique which uses both vertex and
	// fragment programs, supports coloured lights
	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 Examples/BumpMapVP
			{
				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 Examples/BumpMapFP
			{
				param_named_auto lightDiffuse light_diffuse_colour 0 
			}
			
			// Base bump map
			texture_unit
			{
				texture atheneNormalMap.png
				colour_op replace
			}
			// Normalisation cube map
			texture_unit
			{
				cubic_texture nm.png combinedUVW
				tex_coord_set 1
				tex_address_mode clamp
			}
		}
		
		// Decal pass
		pass
		{
			// base colours, not needed for rendering, but as information
			// to lighting pass categorisation routine
			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 egyptrockyfull.jpg 
			}
			
		}
	}

	// This is the fallback which cards which don't have fragment program 
	// support will use
	// 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 Examples/BumpMapVP
			{
				param_named_auto lightPosition light_position_object_space 0
				param_named_auto eyePosition camera_position_object_space
				param_named_auto worldViewProj worldviewproj_matrix
			}
			
			// Base bump map
			texture_unit
			{
				texture atheneNormalMap.png
				colour_op replace
			}
			// Normalisation cube map, with dot product on bump map
			texture_unit
			{
				cubic_texture nm.png 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 egyptrockyfull.jpg
			}
			
		}

	}
}

// Basic Athene statue
material Examples/Athene/Basic
{

	technique
	{
		pass
		{
			ambient 0.3 0.3 0.3
			diffuse 1.0 1.0 0.9

			texture_unit
			{
				texture egyptrockyfull.jpg 
			}
			
		}
	}
}


// Any number of lights, diffuse and specular
material Examples/Athene/NormalMappedSpecular
{

	// This is the preferred technique which uses both vertex and
	// fragment programs, supports coloured lights
	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 Examples/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 Examples/BumpMapFPSpecular
			{
				param_named_auto lightDiffuse light_diffuse_colour 0 
				param_named_auto lightSpecular light_specular_colour 0
			}
			
			// Base bump map
			texture_unit
			{
				texture atheneNormalMap.png
				colour_op replace
			}
			// Normalisation cube map
			texture_unit
			{
				cubic_texture nm.png combinedUVW
				tex_coord_set 1
				tex_address_mode clamp
			}
			// Normalisation cube map #2
			texture_unit
			{
				cubic_texture nm.png combinedUVW
				tex_coord_set 1
				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 egyptrockyfull.jpg 
			}
			
		}
	}

	// 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 Examples/BumpMapVP
			{
				param_named_auto lightPosition light_position_object_space 0
				param_named_auto eyePosition camera_position_object_space
				param_named_auto worldViewProj worldviewproj_matrix
			}
			
			// Base bump map
			texture_unit
			{
				texture atheneNormalMap.png
				colour_op replace
			}
			// Normalisation cube map, with dot product on bump map
			texture_unit
			{
				cubic_texture nm.png 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 egyptrockyfull.jpg 
			}
			
		}

	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -