65 lines
1.3 KiB
Plaintext
65 lines
1.3 KiB
Plaintext
Shader "Carmen/Decal"
|
|
{
|
|
Properties
|
|
{
|
|
_MainTex ("Decal", 2D) = "white" {}
|
|
_Colour ("Colour", Color) = (1.0, 1.0, 1.0, 1.0)
|
|
_Metallic ("Metallic", Range(0.0, 1.0)) = 0.0
|
|
_Smoothness ("Smoothness", Range(0.0, 1.0)) = 0.0
|
|
|
|
[NoScaleOffset] _DetailTex ("Detail Albedo", 2D) = "grey" {}
|
|
_DetailNormal ("Detail Normal", 2D) = "bump" {}
|
|
}
|
|
SubShader
|
|
{
|
|
Tags { "Queue"="Overlay" "RenderType"="Fade" "CanUseSpriteAtlas"="True" }
|
|
LOD 200
|
|
|
|
Cull Back
|
|
Blend SrcAlpha OneMinusSrcAlpha
|
|
Offset -1, -1
|
|
|
|
CGPROGRAM
|
|
#include "UnityCG.cginc"
|
|
#pragma target 4.5
|
|
#pragma surface surf Standard alpha:fade
|
|
|
|
|
|
struct Input
|
|
{
|
|
float2 uv_MainTex;
|
|
float2 uv_DetailTex;
|
|
float2 uv_DetailNormal;
|
|
};
|
|
|
|
|
|
UNITY_DECLARE_TEX2D(_MainTex);
|
|
half4 _Colour;
|
|
half _Metallic;
|
|
half _Smoothness;
|
|
|
|
UNITY_DECLARE_TEX2D(_DetailTex);
|
|
UNITY_DECLARE_TEX2D(_DetailNormal);
|
|
|
|
|
|
void surf (Input IN, inout SurfaceOutputStandard o)
|
|
{
|
|
half4 TexSample = UNITY_SAMPLE_TEX2D(_MainTex, IN.uv_MainTex);
|
|
|
|
o.Albedo = TexSample.rgb;
|
|
//o.Albedo *= UNITY_SAMPLE_TEX2D(_DetailTex, IN.uv_DetailNormal).rgb * 2.0;
|
|
o.Albedo *= _Colour;
|
|
|
|
o.Alpha = TexSample.a * _Colour.a;
|
|
|
|
o.Metallic = _Metallic;
|
|
o.Smoothness = _Smoothness;
|
|
|
|
o.Normal = UnpackNormal(UNITY_SAMPLE_TEX2D(_DetailNormal, IN.uv_DetailNormal));
|
|
}
|
|
ENDCG
|
|
}
|
|
FallBack "Diffuse"
|
|
}
|
|
|