WhiteEngine-专注图形渲染与游戏引擎技术的网站

新浪微薄腾讯微薄

最新碎语:暂无碎语

您的位置:WhiteEngine-专注图形渲染与游戏引擎技术的网站 >Mobile Shader> 默认Mobile diffuse关照贴图shader,带Alpha

默认Mobile diffuse关照贴图shader,带Alpha

使用mobile diffuse烘焙后使用

QQ截图20161031164858.png

Shader "sk/transparent/lightmap_cutout_base"

{
Properties
{
_MainTex("MainTex (RGB)", 2D) = "White"{}
_Cutoff("Alpha Cutoff", range(0,1)) = 0.5
}

SubShader
{
tags {"Queue" = "Opaque"}
LOD 200
pass
{
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_fog
#include "UnityCG.cginc"
sampler2D _MainTex;
fixed _Cutoff;

fixed4 unity_Lightmap_ST;

struct a2v
{
float4 pos : POSITION;
float2 uv : TEXCOORD0;
float4 texcoord1 : TEXCOORD1;  
};

struct v2f
{
float4 pos : SV_POSITION;
float2 uv : TEXCOORD0;
half2 uvLM : TEXCOORD2;
UNITY_FOG_COORDS(1)
};

v2f vert(a2v v)
{
v2f o;
o.pos = mul(UNITY_MATRIX_MVP, v.pos);
o.uv = v.uv;
o.uvLM = v.texcoord1.xy * unity_LightmapST.xy + unity_LightmapST.zw; 
UNITY_TRANSFER_FOG(o, o.pos);
return o; 
}

fixed4 frag(v2f i) : SV_Target
{

fixed4 col;

fixed4 texColor = tex2D(_MainTex, i.uv); 
clip(texColor.a - _Cutoff);
col = texColor;
fixed3 lm = DecodeLightmap(UNITY_SAMPLE_TEX2D(unity_Lightmap, i.uvLM.xy));
col.rgb *= lm;
UNITY_APPLY_FOG(i.fogCoord, col);
return col;
}
ENDCG
}
}

FallBack "Transparent/Cutout/VertexLit"
}

---

转载请注明本文标题和链接:《默认Mobile diffuse关照贴图shader,带Alpha

分享到:

发表评论

路人甲 表情
看不清楚?点图切换 Ctrl+Enter快速提交