Glass shader turn white when double sided!? Am i misunderstanding somethig???
Can someone send help? There must be a very stupid issue cus i am a newb. I got this glass surface shader with a normal map when i tried to turn it double sided by adding Cull Off, the whole things turn white. it doesn't seem to be the problem of _Color.
Shader "Custom/Glass" {
Properties{
_Color("Color", Color) = (0.5, 0.5, 0.5, 1)
_MainTex("Albedo", 2D) = "white" {}
_Smoothy("Smoothness", Range(0,1)) = 0.5
_Shininess("Shininess", Range(0.01, 1)) = 0.078125
_myAlpha("Over All Alpha", Range(0.0, 1.0)) = 0.5
_NorTex("Normal", 2D) = "bump"{}
//Rim
[Toggle(RIM)] _RIM("Fresnel Rim?", Float) = 0
_RimColor("Fresnel Rim Color", Color) = (0.49,0.94,0.64,1)
_RimAmt("Fresnel Amount", Range(0,5)) = 1.5
}
Subshader
{
Tags {"Queue" = "transparent" "RenderType" = "Transparent"}
LOD 100
Cull Off
ZWrite OFF
Blend SrcAlpha OneMinusSrcAlpha
CGPROGRAM
#pragma surface surf StandardSpecular alpha:premul
#pragma shader_feature RIM // rim fresnel toggle
sampler2D _MainTex;
sampler2D _NorTex;
half4 _Color;
half _Shininess;
half _Smoothy;
fixed _myAlpha;
float4 _RimColor;
half _RimAmt;
struct Input
{
float2 uv_MainTex;
float3 lightDir;
float3 worldPos; // world position
float3 viewDir; // view direction from camera
};
void surf(Input IN, inout SurfaceOutputStandardSpecular o)
{
float rim = 1 - saturate(dot(IN.viewDir, o.Normal)); // calculate fresnel rim
#if RIM
o.Emission = _RimColor.rgb * pow(rim, _RimAmt); // fresnel rim
#endif
//Output
fixed4 c = tex2D(_MainTex, IN.uv_MainTex)* _Color;
c = (c-0.5)*10 + 0.5;
o.Albedo = c.rgb;
o.Normal = UnpackNormal(tex2D(_NorTex, IN.uv_MainTex));
o.Smoothness = _Smoothy;
o.Specular = _Shininess;
o.Alpha = _myAlpha;
}
ENDCG
}
FallBack "Transparent/VertexLit"
}
Answer by unity_Xj8VDiweJd2zgA · Aug 15, 2018 at 03:59 AM
Nevermind I figured it out
It's the rim that's causing the problem.
Hey I am using the shader graph, and I enabled render both faces on plane type mesh, one side looks great but the other seems somewhat whitish, just wondering if you can help?
Your answer
![](https://koobas.hobune.stream/wayback/20220612172831im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Make albedo transparent and keep the glossiness and reflection visible - standard shader 0 Answers
how to hide objects inside an invisible object? 0 Answers
Problem with overlapping objects and transparency 0 Answers
Dynamic Spring Action with given force at runtime 0 Answers
Leaves disappear in game mode 0 Answers