本文主要是介绍Fixed Function shaders实例,希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
一、显示纯颜色物体
Shader "Example/FixedSolidColor" {Properties{_Color("MainColor (RGB)", Color) = (1,1,1,1)}SubShader{pass {Lighting onMaterial{Diffuse[_Color]}}}FallBack "Diffuse"
}
二、各种颜色通道
Shader "Example/FixedFullColor"
{Properties{_Color("Main Color", Color) = (1,1,1,0.5)_SpecColor("Spec Color", Color) = (1,1,1,1)_Emission("Emmisive Color", Color) = (0,0,0,0)_Shininess("Shininess", Range(0.01, 1)) = 0.7}SubShader{Pass{Lighting OnSeparateSpecular OnMaterial{Diffuse[_Color]Ambient[_Color]Shininess[_Shininess]Specular[_SpecColor]Emission[_Emission]}}}
}
三、显示一张贴图
Shader "Example/FixedOnePic"
{Properties{_Color("MainColor(RGB)",Color) = (1,1,1,1)_MainTex("Base (RGB)", 2D) = "white" {}}SubShader{Pass{Lighting onColor(1,1,0,1)Material{Diffuse[_Color]}SetTexture[_MainTex]{//材质 * 定点颜色Combine texture * primary DOUBLE}}}FallBack "Diffuse"
}
四、多张贴图叠加
Shader "Example/FixedMulPic"
{Properties{_Color("MainColor(RGB)",Color) = (1,1,1,1)_MainTex("Base (RGB)", 2D) = "white" {}_MainTex2("Base2 (RGB)", 2D) = "white" {}_MainTex3("Base3 (RGB)", 2D) = "white" {}}SubShader{Pass{Lighting onColor(1,1,0,1)Material{Diffuse[_Color]}SetTexture[_MainTex]{//第一张材质 * 定点颜色Combine texture * primary DOUBLE}SetTexture[_MainTex2]{//材质 * 之前累积(这里即第一张材质)Combine texture * previous DOUBLE}SetTexture[_MainTex3]{//材质 * 之前累积Combine texture * previous DOUBLE}}}FallBack "Diffuse"
}
五、透明通道贴图+双面显示
Shader "Example/FixedAlphaCull"
{Properties{_Color("MainColor(RGB)",Color) = (1,1,1,1)_MainTex("Base (RGB)", 2D) = "white" {}}SubShader{Pass{Blend SrcAlpha OneMinusSrcAlphaCull offLighting onColor(1,1,0,1)Material{Diffuse[_Color]}SetTexture[_MainTex]{Combine texture * primary DOUBLE}}}FallBack "Diffuse"
}
这篇关于Fixed Function shaders实例的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!