- Home /
 
Adding Alpha-Transparency to Shader
Hi, first off im very new to shaders in Unity. Never tryed anything like this before tbh and i just need a quick fix for now.
Im working with an orthographic camera and want to cast shadows from a point light. As most may already now, this is not possible by default.
I found a shader which enables shadows for orthographic cameras though.
 Shader "BoShadowShader" {
     Properties {
         _MainTex ("Base (A=Opacity)", 2D) = "white"
         _BumpMap ("Normalmap", 2D) = "bump" {}
         _Color ("Main Color (A=Opacity)", Color) = (1,1,1,1)
     }
     
     SubShader {
         Tags { "RenderType"="Opaque" }
         LOD 400
     
         CGPROGRAM
         #pragma surface surf BlinnPhong fullforwardshadows
         sampler2D _MainTex;
         sampler2D _BumpMap;
         fixed4 _Color;
 
 
         struct Input {float2 uv_MainTex; float2 uv_BumpMap;};
     
         void surf (Input IN, inout SurfaceOutput o) {
               fixed4 tex = tex2D(_MainTex, IN.uv_MainTex);
                o.Albedo = tex.rgb * _Color.rgb;
                o.Gloss = tex.a;
                o.Alpha = tex.a * _Color.a;
           o.Normal = UnpackNormal(tex2D(_BumpMap, IN.uv_BumpMap));
  
        }
         ENDCG
 
 }
     Fallback "VertexLit"
 }
 
               The problem is: I need the materials to have transparent parts, defined by the alpha channel of my images.
I tryed lots of stuff but i cant make it work (guess because i have no clue what im doing).
Does any1 have an idea what i can do about it?
Your answer
 
             Follow this Question
Related Questions
Toon Lighted Alpha 1 Answer
Alpha Transparency Shader Issue 1 Answer
Render transparent material without double occlusion 2 Answers
alpha maps as a separate file... 1 Answer