ZWrite Off
Shader "Transparent/Bumped Specular+" {
Properties {
_Color ("Main Color", Color) = (1,1,1,1)
_SpecColor ("Specular Color", Color) = (0.5, 0.5, 0.5, 0)
_Shininess ("Shininess", Range (0.01, 1)) = 0.078125
_MainTex ("Base (RGB) TransGloss (A)", 2D) = "white" {}
_BumpMap ("Bumpmap", 2D) = "bump" {}
}
Category {
Tags { "IgnoreProjector"="True" "RenderType"="Transparent" "Queue"="Transparent-100" }
LOD 200
Alphatest Greater 0
Fog { Color [_AddFog] }
ZWrite On
ColorMask RGB
// ------------------------------------------------------------------
// ARB fragment program
SubShader {
UsePass "Transparent/Specular/BASE"
// Pixel lights
Pass {
Blend SrcAlpha OneMinusSrcAlpha
Name "PPL"
Tags { "LightMode" = "VertexOnly" }
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
#pragma multi_compile_builtin
#pragma fragmentoption ARB_fog_exp2
#pragma fragmentoption ARB_precision_hint_fastest
#include "UnityCG.cginc"
#include "AutoLight.cginc"
struct v2f {
V2F_POS_FOG;
LIGHTING_COORDS
float3 uvK; // xy = UV, z = specular K
float2 uv2;
float3 viewDirT;
float3 lightDirT;
};
uniform float4 _MainTex_ST, _BumpMap_ST;
uniform float _Shininess;
v2f vert (appdata_tan v)
{
v2f o;
PositionFog( v.vertex, o.pos, o.fog );
o.uvK.xy = TRANSFORM_TEX(v.texcoord,_MainTex);
o.uvK.z = _Shininess * 128;
o.uv2 = TRANSFORM_TEX(v.texcoord,_BumpMap);
TANGENT_SPACE_ROTATION;
o.lightDirT = mul( rotation, ObjSpaceLightDir( v.vertex ) );
o.viewDirT = mul( rotation, ObjSpaceViewDir( v.vertex ) );
TRANSFER_VERTEX_TO_FRAGMENT(o);
return o;
}
uniform sampler2D _BumpMap;
uniform sampler2D _MainTex;
uniform float4 _Color;
float4 frag (v2f i) : COLOR
{
float4 texcol = tex2D( _MainTex, i.uvK.xy );
// get normal from the normal map
float3 normal = tex2D(_BumpMap, i.uv2).xyz * 2 - 1;
half4 c = SpecularLight( i.lightDirT, i.viewDirT, normal, texcol, i.uvK.z, LIGHT_ATTENUATION(i) );
c.a = texcol.a * _Color.a;
return c;
}
ENDCG
}
}
}
FallBack "VertexLit", 1
}
Сейчас этот форум просматривают: нет зарегистрированных пользователей и гости: 2