Im attempting to make a two sided PBR shader.
Ive got both sides showing using the VFACE flipping teqniue described here (Standard Shader (modified to be double sided) is very shiny on the underside - Unity Engine - Unity Discussions)
However, the issue i’m having is that the albedo of the shader is now only appearing on the underside. It doesnt matter if i just use a colour tint or apply texture, its not visible from the top.
From above
Same plane from below.
Any help would be greatly appreciated.
My shader code:
Shader "Custom/test" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(0,1)) = 0.5
_Metallic ("Metallic", Range(0,1)) = 0.0
_NormalMap ("bump",2D) = "bump"{}
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD 200
Cull Off
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Standard fullforwardshadows
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _MainTex;
struct Input {
float2 uv_MainTex;
fixed facing : VFACE;
};
half _Glossiness;
half _Metallic;
fixed4 _Color;
sampler2D _NormalMap;
void surf (Input IN, inout SurfaceOutputStandard o) {
// Albedo comes from a texture tinted by color
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
// Metallic and smoothness come from slider variables
o.Metallic = _Metallic;
o.Normal = UnpackNormal(tex2D(_NormalMap, IN.uv_MainTex));
o.Smoothness = _Glossiness;
o.Alpha = c.a;
if (IN.facing < 0.5)
o.Normal *= -1.0;
}
ENDCG
}
FallBack "Diffuse"
}
Without the line
if (IN.facing < 0.5)
o.Normal *= -1.0;
The opposite occurs (Texture/tint only shows on the top side)