- Home /
Bump Map, Specular and Shininess Shader
Hello all –
I'm currently trying to write a shader that will blend between two different textures, bump maps, and transparencies.
Unfortunately, it appears that while textures and transparencies are working, the bump maps are not.
Additionally, it doesn't appear that the specularlity is working, nor the shininess.
Does anyone have any suggestions?
Thanks!
Shader "Bumped Specular Blend" {
Properties {
_Blend ("Blend Between Forward and Reverse", Range(0, 1) ) = 0
//_Color ("Main Color", Color) = (1,1,1,1)
_Transparency ("Transparency", Range(0, 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 ("Normalmap", 2D) = "bump" {}
_BlendTex ("Blend (RGB)", 2D) = "black" {}
_BlendBump ("Blend NormalMap", 2D) = "bump" {}
}
SubShader {
//Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
//LOD 400
Pass {
Material {
Shininess[_Shininess]
Specular[_SpecColor]
}
AlphaTest Greater [_Transparency]
SetTexture[_MainTex]
SetTexture[_BlendTex] {
ConstantColor (0, 0, 0, [_Blend])
Combine texture Lerp(constant) previous
}
}
CGPROGRAM
#pragma surface surf BlinnPhong alpha
struct Input {
float2 uv_MainTex;
float2 uv_BumpMap;
};
sampler2D _MainTex;
sampler2D _BumpMap;
sampler2D _BlendTex;
sampler2D _BlendBump;
float _Blend;
void surf(Input IN, inout SurfaceOutput o) {
//o.Albedo = tex2D(_MainTex, IN.uv_MainTex).rgb;
o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
}
ENDCG
Pass {
Material {
Shininess[_Shininess]
Specular[_SpecColor]
}
ZWrite off
ZTest Less
AlphaTest LEqual [_Transparency]
Blend SrcAlpha OneMinusSrcAlpha
SetTexture[_MainTex]
SetTexture[_BlendTex] {
ConstantColor (0, 0, 0, [_Blend])
Combine texture Lerp(constant) previous
}
}
}
FallBack "Transparent/VertexLit"
}
Comment
Your answer
Follow this Question
Related Questions
nothing change when i add a bumped specular or bumped diffuse shader 2 Answers
Implementing specular in a shader on iOS 1 Answer
Texture Offset - bump AND main color 3 Answers
Can i apply terrain materials to specific textures only? 0 Answers
Shader programming question for Cg expert : Scaling textures 5 Answers