Hi,
i’m trying to make a shader i added a few stuff but it is doing things that make my eyes go bazurk.
Here’s the shader:
Shader "Exile/Skydome/Animated Clouds" {
Properties {
_CloudColor ("Cloud Color", Color) = (0,0,0,1)
_MainTex ("Cloud pattern", 2D) = "black" {}
_NormalMap ("Depth Map", 2D) = "white" {}
_MarbleTex ("Marble Texture", 2D) = "white" {}
_SunDir ("SunDir", Vector) = (0,0,1,0)
_RimMultiplier("Rim multiplier", Range (0.0, 1.0)) = 0.3
}
SubShader {
Tags { "RenderType"="Transparent" "Queue"="Transparent"}
LOD 200
CGPROGRAM
#pragma surface surf Lambert alpha
sampler2D _MainTex;
sampler2D _NormalMap;
sampler2D _MarbleTex;
float4 _CloudColor;
float4 _SunDir;
float _RimMultiplier;
struct Input {
float2 uv_MainTex;
float2 uv_NormalMap;
float2 uv_MarbleTex;
};
void surf (Input IN, inout SurfaceOutput o) {
half4 c = tex2D (_MainTex, IN.uv_MainTex);
half3 m = tex2D (_MarbleTex, IN.uv_MarbleTex);
half3 n = UnpackNormal(tex2D(_NormalMap, IN.uv_NormalMap));
float alpha = c.a * _CloudColor.a;
o.Albedo = c;
o.Alpha = alpha;
if((alpha >= _RimMultiplier))
o.Normal = n;
else
o.Normal = 2 * _SunDir;
//o.Alpha = alpha * m.r;
}
ENDCG
}
FallBack "Diffuse"
}
Herer’s an image
The model in question is about that ring with the white pathes on it.
Basically i want to check if a alpha value of a pixel is greater than a certain value and just apply the normal map to it.
If the alpha value of the pixel is less than the given constant then give that pixel a normal of 2.
The normal map also reacts to directional lights so at the place where the normal map is not applied (the place where the directional light shining away from it the pixel with alpha less than given value should de 2.0 en multiply that with the sun direction vector.
Now that is working fine.
But adding a color to the albedo adds the color to the normal map and not the diffuse texture underneath it.
Any thoughts on that ?
And also as yo ucan see in the picture the border between the lesser and greater pixel is like alpha testing foliage , is there a way to smoothen that ?
Thanks!