- Home /
Transparent object with look front of all object
Hello Every one,
I am trying to create a surface with a bunch of point I have the script that slipts the surface into triangle. I want to that the surface look front all other object with transparency
For now, as you can see, objects behind look well, but objects front just disappear in pink color
I would like to look like this :
I am not really competent in graphic stuff.I try to solve with a shader. I create this shader base on my research
Shader "Custom/Zone" {
Properties {
_Color ("Color", Color) = (1,1,1,0.5)
_MainTex ("Color (RGB) Alpha (A)", 2D) = "white" {}
//_Glossiness ("Smoothness", Range(0,1)) = 0.5
//_Metallic ("Metallic", Range(0,1)) = 0.0
// _Cutoff ("Base Alpha cutoff", Range (0,.9)) = .5
}
SubShader {
Pass {
Material {
Diffuse (1,1,1,1)
}
Cull Off
ZTest Greater
ZWrite On
}
Tags { "Queue"="Transparent" "RenderType"="Transparent" }
LOD 200
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
#pragma surface surf Standard fullforwardshadows Lambert alpha
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
sampler2D _MainTex;
//#pragma surface surf
struct Input {
float2 uv_MainTex;
};
half _Glossiness;
half _Metallic;
fixed4 _Color;
void surf (Input IN, inout SurfaceOutputStandard o) {
// Albedo comes from a texture tinted by color
fixed4 c = tex2D (_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
o.Alpha = tex2D (_MainTex, IN.uv_MainTex).a;
// Metallic and smoothness come from slider variables
o.Metallic = _Metallic;
o.Smoothness = _Glossiness;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}
Ps: for point and ligne i use UI image on world Space Canvas, I found here a shader that put it in front of every object. So if you have a solution to create my zone with UI element that can be great. :)
Try the 7 ZTest modes:
http://docs.unity3d.com/$$anonymous$$anual/SL-CullAndDepth.html
Let me know if this helps
That makes the opposite, everything is hiden: I just tried the other ZTest , none is good.
That makes the opposite, everything is hiden: ![alt text][1] I just tried the other ZTest , none is good.
But i use the subshader given in section Transparent shader with depth writes With adding ZTest Greater. It's look what's I wanted.
Thanks [1]: /storage/temp/65022-zone3.png
AFAIk you shouldn't have ZWrite On when handling Transparent meshes, try turning that Off
Your answer
![](https://koobas.hobune.stream/wayback/20220612070145im_/https://answers.unity.com/themes/thub/images/avi.jpg)