Transparency render issue

I understand that this has been asked before but I’ve done almost everything to get it to work. This might be beyond the scope of my expertise because I barely messed with shaders which I’m saving for last in regards to learning Unity.

Here’s the problem as I’m sure you’ve seen before:

So there are a lot of solutions out there but none that I understand.

I tried the custom shader solution but I have a feeling that I’m adding the shader code incorrectly. I create a new shader, open the compiled shader, and replace the existing code with the solution code, correct? Or is there somewhere I place the code within the shader code that Unity provides in the shader?

I also tried the ‘creating the face at a distance from the main object as part of the object to force render priority’ trick but that didn’t work.

Then there’s renderQueue. I really have no idea how to use that or if it solves this problem.

If any one of these answers is the correct solution, can you say step by step how to fix this seemingly minor problem rather than responding with vague external resources or solutions?

I know that sounds rude but I see this problem as kind of an annoying obstacle that’s taking time away from what I should be doing. Sorry, I have really bad OCD and I’d rather not get into writing my own shaders just yet. :slight_smile:

EDIT: They key is not rendering correctly which is spinning and some of the faces of the key are showing instead of the closer faces. I will need to fade this key out so that’s why I’m using the transparent/specular shader. Here are some images…Unity’s kind of being a pain right now so I’ll need a minute.

Edit:

I did find something on this thread concerning Zwrite because the guy has the same problem but Zwrite doesn’t seem to be in the shader.

http://forum.unity3d.com/threads/41007-Transparent-Diffusr-shader-problem-Done

Commented out Zwrite in the transparent/diffuse shader. Didn’t work.

Then I tried this shader:

Shader "Transparent/VertexLit with Z" {
	Properties {
	    _Color ("Main Color", Color) = (1,1,1,1)
	    _SpecColor ("Spec Color", Color) = (1,1,1,0)
	    _Emission ("Emissive Color", Color) = (0,0,0,0)
	    _Shininess ("Shininess", Range (0.1, 1)) = 0.7
	    _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
	}
	 
	SubShader {
	    Tags {"RenderType"="Transparent" "Queue"="Transparent"}
	    // Render into depth buffer only
	        Pass {
	        ColorMask 0
	    }
	    // Render normally
	    Pass {
	        ZWrite Off
	        Blend SrcAlpha OneMinusSrcAlpha
	        ColorMask RGB
	        Material {
	            Diffuse [_Color]
	            Ambient [_Color]
	            Shininess [_Shininess]
	            Specular [_SpecColor]
	            Emission [_Emission]
	        }
	        Lighting On
	        SetTexture [_MainTex] {
	            Combine texture * primary DOUBLE, texture * primary
	        }
	    }
	}
}

This strangely made the object disappear altogether. Sigh.

Those missing faces in the key probably means it was modelled with some flipped normals. In other words, the key is the problem, not your part.

You could turn off backface culling in the shader, but better to fix the key (lots of places here about flipped normals, missing faces … , but might be better to look at a site for the program you made the key with.) If someone else made it, the mere words “some flipped normals” are all you have to tell them.

Also, you didn’t write you did this, but in the Material for the key, switch to the new shader (whatever name you put in the very top of the new shader code, that should appear in the shader dropdown) (but if you fix the key, you won’t need a new shader.)

If it’s not flipped normals then it might be a sort order problem - bet it goes away if you turn it back to a non-transparent shader?

Here’s the shader that worked to my surprise because I tried this yesterday and there was no change:

Shader "Transparent/VertexLit with Z" {
	Properties {
	    _Color ("Main Color", Color) = (1,1,1,1)
	    _MainTex ("Base (RGB) Trans (A)", 2D) = "white" {}
	}
	 
	SubShader {
	    Tags {"RenderType"="Transparent" "Queue"="Transparent"}
	    // Render into depth buffer only
	    Pass {
	        ColorMask 0
	    }
	    // Render normally
	    Pass {
	        ZWrite Off
	        Blend SrcAlpha OneMinusSrcAlpha
	        ColorMask RGB
	        Material {
	            Diffuse [_Color]
	            Ambient [_Color]
	        }
	        Lighting On
	        SetTexture [_MainTex] {
	            Combine texture * primary DOUBLE, texture * primary
	        } 
	    }
	}
}

And probably all I had to do was add Zwrite Off instead of just commenting it out in the transparent/diffuse shader.

Anyway, it’s not polite for me to accept my own answer like last time so I’ll pick someone. Here’s what the final product should look like:

16979-untitled.jpg

It’s amazing how different the result is. I was going to use @Griffo 's method yesterday but I’m just way too stubborn for compromises, lol.