Issue with Transparent Diffuse shader for fade in/out operation.

I’m making a relatively simple animated exploded view of a mechanical assembly. As the parts explode I want them to fade out completely. I am using Transparent Diffuse shaders for the part materials to allow me to set the alpha channel between 1 and 0 to animate the transparency. This works and and am happy with the animation.

However, when the alpha channel is set 1 (0% transparency) I can still see through some parts of the objects when I want them to be solid, like a standard Diffuse shader. Is this inherent when using Transparent Diffuse shader, and is there a way around this?

Many thanks,


I too noted such problem. The truth I create projects for mobile devices. Decision: to write the shader. The example is lower:

 Shader "Custom/myDifTrans" {
  Properties {
   _Color ("Main Color", Color) = (1,1,1,1)
   _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}

  SubShader {
   Tags {"Queue"="Transparent" "IgnoreProjector"="True" "RenderType"="Transparent"}
   Blend SrcAlpha OneMinusSrcAlpha // use alpha blending
   ZWrite On //write depth in buffer
   LOD 200

   #pragma surface surf Lambert

   sampler2D _MainTex;
   fixed4 _Color;

   struct Input {
    float2 uv_MainTex;

   void surf (Input IN, inout SurfaceOutput o) {
    fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
    o.Albedo = c.rgb;
    o.Alpha = c.a;

  Fallback "Diffuse"

Or second way: At first, take the standart shaders sources there : Choose Alpha-Diffuse.shader, copy-paste into project, open, rename(for example, MyTrans), replace line

 ZWrite Off

On line

 ZWrite On

I hope that it will help you.