Thanks for all the info so far guys!
hippocoder’s tip would work how just wanted it. Just another question can it be implemented in this shader a got it only needs to take into count the _Detail because i use that for the ink texture.
Here is the shader:
Shader "Custom/Wolf" {
Properties {
_Color ("Main Color", Color) = (.5,.5,.5,1)
_SpecColor ("Specular Material Color (RGB)", Color) = (1,1,1,1)
_OutlineColor ("Outline Color", Color) = (0,0,0,1)
_Outline ("Outline width", Range (0.0, 0.03)) = .005
_ShinPower ("Shininess", Range(0,1)) = 0.5
_GlossPower ("Gloss", Range(0.01,1)) = 0.5
_MainTex ("Base (RGB)", 2D) = "white" { }
_BumpMap ("Bumpmap", 2D) = "bump" {}
_Detail ("Detail", 2D) = "white" {}
_SpecularTex ("Specular Map", 2D) = "gray" {}
_RampTex ("Shading Ramp", 2D) = "white" {}
}
CGINCLUDE
#include "UnityCG.cginc"
struct appdata {
float4 vertex : POSITION;
float3 normal : NORMAL;
};
struct v2f {
float4 pos : POSITION;
float4 color : COLOR;
};
uniform float _Outline;
uniform float4 _OutlineColor;
v2f vert(appdata v) {
v2f o;
o.pos = mul(UNITY_MATRIX_MVP, v.vertex);
float3 norm = mul ((float3x3)UNITY_MATRIX_IT_MV, v.normal);
float2 offset = TransformViewToProjection(norm.xy);
o.pos.xy += offset * o.pos.z * _Outline;
o.color = _OutlineColor;
return o;
}
ENDCG
SubShader {
Tags { "Queue" = "Geometry+10" "RenderType" = "Opaque" }
Pass {
Name "OUTLINE"
Tags { "LightMode" = "Always" }
Cull Front
ZWrite On
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma vertex vert
#pragma fragment frag
half4 frag(v2f i) : COLOR {
return i.color;
}
ENDCG
}
CGPROGRAM
#pragma surface surf Wolf
#pragma only_renderers d3d9
#pragma target 3.0
struct Input
{
float2 uv_MainTex;
float2 uv_BumpMap;
float3 worldNormal;
INTERNAL_DATA
};
sampler2D _MainTex, _SpecularTex, _BumpMap, _RampTex, _Detail;
uniform float3 _Color;
float _ShinPower;
float _GlossPower;
inline fixed4 LightingWolf (SurfaceOutput s, fixed3 lightDir, fixed3 viewDir, fixed atten)
{
fixed3 h = normalize (lightDir + viewDir);
fixed NdotL = dot(s.Normal, lightDir) * 0.5 + 0.5;
fixed3 ramp = tex2D(_RampTex, float2(NdotL * atten)).rgb;
float nh = max (0, dot (s.Normal, h));
float spec = pow (nh, s.Gloss * 128) * s.Specular;
fixed4 c;
c.rgb = ((s.Albedo * _Color.rgb * ramp * _LightColor0.rgb + _LightColor0.rgb * spec * s.Specular * _SpecColor) * (atten * 2));
return c;
}
void surf (Input IN, inout SurfaceOutput o)
{
o.Albedo = tex2D(_MainTex, IN.uv_MainTex).rgb * _Color;
o.Albedo *= tex2D (_Detail, IN.uv_MainTex).a * 2;
o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
float3 specGloss = tex2D(_SpecularTex, IN.uv_MainTex).rgb;
o.Specular = specGloss.r * _ShinPower;
o.Gloss = specGloss.g * _GlossPower;
}
ENDCG
}
Fallback "Diffuse"
}
What do you guys think, could be implemented into that shader?