标签:osi cgi fragment clip ogr data for off tran
Shader "Game_XXX/Scenes/HouseShow" { Properties { _MainTex ("Texture", 2D) = "white" {} } SubShader { Tags { "Queue"="Geometry"} Pass { CGPROGRAM #pragma vertex vert #pragma fragment frag #include "UnityCG.cginc" #pragma multi_compile LIGHTMAP_OFF LIGHTMAP_ON ///// LightMap打开或者关闭 struct appdata { float4 vertex : POSITION; float2 uv : TEXCOORD0; float2 uvLM:TEXCOORD1;///// 第二套UV }; struct v2f { float2 uv : TEXCOORD0; float4 vertex: SV_POSITION; #ifdef LIGHTMAP_ON half2 uvLM : TEXCOORD2; ///// 如果有烘焙图的话,定义lightMapUV #endif }; sampler2D _MainTex; float4 _MainTex_ST; v2f vert (appdata v) { v2f o; o.vertex = UnityObjectToClipPos(v.vertex); o.uv = TRANSFORM_TEX(v.uv,_MainTex); #ifdef LIGHTMAP_ON o.uvLM = v.uvLM.xy * unity_LightmapST.xy + unity_LightmapST.zw;/////如果有红配图,算UV #endif return o; } fixed4 frag (v2f i) : SV_Target { fixed4 col = tex2D(_MainTex, i.uv); #ifdef LIGHTMAP_ON fixed3 lm = ( DecodeLightmap (UNITY_SAMPLE_TEX2D(unity_Lightmap, i.uvLM)));///// col.rgb *= lm;/////如果有烘焙图,将烘焙图参与计算 #endif return col; } ENDCG } } }
标签:osi cgi fragment clip ogr data for off tran
原文地址:http://www.cnblogs.com/baicaishisan/p/7845185.html