- Home /
Question by
samyatchmenoff · Jun 28, 2011 at 10:35 PM ·
shaderalphasurface
Alpha in surface shader
I have the following very simple surface shader but no matter what I do with the alpha, it always appears slightly transparent.
Shader "Sphere Shader" {
Properties {
_Color ("Color", Color) = (1,1,1,1)
}
SubShader {
Tags { "RenderType" = "Opaque" }
CGPROGRAM
#pragma surface surf Lambert alpha
struct Input {
float3 viewDir;
};
float4 _Color;
void surf (Input IN, inout SurfaceOutput o) {
o.Albedo = _Color.rgb;
o.Alpha = 1.0;
o.Gloss = 0.0;
}
ENDCG
}
Fallback "VertexLit"
}
What's wrong??
Comment
If you set the alpha to 1.0 then you don't want alpha
in the compiler directive.
Still a valid question if we assume it is cut down from something more complicated.
Best Answer
Answer by samyatchmenoff · Jun 29, 2011 at 12:07 AM
Figured this one out on my own. I needed to add the tag "Queue" = "Transparent" so it is rendered after opaque geometry.
@samyatchmenoff, mark your answer as correct (the check button below the voting thumbs). It will help other people with similar problems to find the answer.
I tried this and I am still getting a slightly transparent object. Do you know of any other solution?
Your answer
![](https://koobas.hobune.stream/wayback/20220612124825im_/https://answers.unity.com/themes/thub/images/avi.jpg)