- Home /
shader causes triangles to dissapear in U4 (worked in U3)
I'm using the shader I found on the wiki and on here to make a self lit transparent material and it was working fine in Unity 4, but now in Unity 4 it completely disappears at certain angles. When looking at it straight on, it's fine, but turn too much to the side and some triangles vanish. I attached the shader to a sphere and it looks like it's rendering the backfaces and not the front faces as well as when it's in front of something with the same shader, the one in back is rendered on top. (edit: upon further testing, this shader has trouble when it's on top of any other shader with a transparency map, not just itself. This is also reproducible in editor when I change the camera to just the right angle, but I do have to be zoomed out some to see the error, if I zoom in it works ok.) Here is the shader, any idea why id does this?
Shader "AlphaSelfIllum" {
Properties {
_Color ("Color Tint", Color) = (1,1,1,1)
_MainTex ("SelfIllum Color (RGB) Alpha (A)", 2D) = "white"
}
Category {
Lighting On
Cull Back
Blend SrcAlpha OneMinusSrcAlpha
Tags {Queue=Transparent}
SubShader {
Material {
Emission [_Color]
}
Pass {
ZWrite Off //on/off gives me some different issues
SetTexture [_MainTex] {
Combine Texture * Primary, Texture * Primary
}
}
}
}
}
I have a feeling the ZWrite might be part of the issue, but I have no experience with shaders. Please help.
just checked with the default build in shaders and the same thing happens.