evelynshilosky

Double Sided Standard Unity Shader (Use on Models to show material on both inside & outside)

Nov 13th, 2025
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.28 KB | None | 0 0
  1. Shader "Custom/DoubleSidedStandard"
  2. {
  3.     Properties
  4.     {
  5.         _Color ("Color", Color) = (1,1,1,1)
  6.         _MainTex ("Texture", 2D) = "white" {}
  7.     }
  8.     SubShader
  9.     {
  10.         Tags { "RenderType"="Opaque" }
  11.         LOD 100
  12.  
  13.         // Disable backface culling to render both sides
  14.         Cull Off
  15.  
  16.         Pass
  17.         {
  18.             CGPROGRAM
  19.             #pragma vertex vert
  20.             #pragma fragment frag
  21.             #include "UnityCG.cginc"
  22.  
  23.             struct appdata
  24.             {
  25.                 float4 vertex : POSITION;
  26.                 float2 uv : TEXCOORD0;
  27.             };
  28.  
  29.             struct v2f
  30.             {
  31.                 float2 uv : TEXCOORD0;
  32.                 float4 vertex : SV_POSITION;
  33.             };
  34.  
  35.             sampler2D _MainTex;
  36.             float4 _MainTex_ST;
  37.             fixed4 _Color;
  38.  
  39.             v2f vert (appdata v)
  40.             {
  41.                 v2f o;
  42.                 o.vertex = UnityObjectToClipPos(v.vertex);
  43.                 o.uv = TRANSFORM_TEX(v.uv, _MainTex);
  44.                 return o;
  45.             }
  46.  
  47.             fixed4 frag (v2f i) : SV_Target
  48.             {
  49.                 fixed4 texColor = tex2D(_MainTex, i.uv) * _Color;
  50.                 return texColor;
  51.             }
  52.             ENDCG
  53.         }
  54.     }
  55. }
  56.  
Advertisement
Add Comment
Please, Sign In to add comment