Hola chicos, estoy intentando hacer un shader decal con normal map pero no da resultado ¿alguna idea?:
Shader "Custom/Decal" {
Properties {
_Color ("Main Color", Color) = (1, 1, 1, 1)
_MainTex ("Base (RGB)", 2D) = "white" {}
_BumpMap ("Bumpmap", 2D) = "bump" {}
_DecalTex ("Decal (RGBA)", 2D) = "black" {}
}
SubShader
{
Tags {
"RenderType" = "Opaque"
"Queue"="Transparent"
"IgnoreProjector"="True"
"RenderType"="Transparent"
}
Pass
{
BindChannels {
Bind "Vertex", vertex
Bind "normal", normal
Bind "texcoord", texcoord0 // main uses 1st uv
Bind "texcoord1", texcoord1 // decal uses 2nd uv
}
SetTexture [_MainTex]
{
constantColor [_Color]
Combine texture * constant
}
SetTexture [_DecalTex]
{
combine texture lerp (texture ) previous
}
}
CGPROGRAM
#pragma surface surf Lambert
struct Input
{
float2 uv_MainTex;
float2 uv_BumpMap;
float2 uv_DecalTex;
};
sampler2D _MainTex;
sampler2D _BumpMap;
sampler2D _DecalTex;
void surf (Input IN, inout SurfaceOutput o)
{
o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb;
o.Normal = UnpackNormal (tex2D (_BumpMap, IN.