Question by
almanno · Aug 05, 2018 at 08:10 PM ·
scripting problemshaderscript.effect
Hello, I'm looking for help to achieve invisibility effect, I have a fragment of the code but not work
@bgolus Hello, I got a video that does the effect I'm trying to do but does not give a tutorial on how to do it, I post the video and a screenshot to point out the effect I'm looking for, it's basically that the object that is behind is not visible of this "invisible" wall. I have a fragment of the code but not work
Link Video: https://www.youtube.com/watch?v=SNxFPUeSUfs
Code:
Shader "Invisible" { Properties { [PerRendererData] _MainTex ("Sprite Texture", 2D) = "white" {} _Color ("Tint", Color) = (1,1,1,1) [MaterialToggle] PixelSnap ("Pixel snap", Float) = 0 }
SubShader
{
Tags
{
"Queue"="Geometry+2"
"IgnoreProjector"="True"
"RenderType"="Opaque"
"PreviewType"="Cube"
"CanUseSpriteAtlas"="True"
}
Cull Off
Lighting Off
ZWrite Off
CGPROGRAM
#pragma surface surf Lambert vertex:vert
#pragma multi_compile DUMMY PIXELSNAP_ON
sampler2D _MainTex;
fixed4 _Color;
struct Input
{
float2 uv_MainTex;
fixed4 color;
};
void vert (inout appdata_full v, out Input o)
{
#if defined(PIXELSNAP_ON) && !defined(SHADER_API_FLASH)
v.vertex = UnityPixelSnap (v.vertex);
#endif
v.normal = float3(0,0,-1);
UNITY_INITIALIZE_OUTPUT(Input, o);
o.color = v.color * _Color;
}
void surf (Input IN, inout SurfaceOutput o)
{
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * IN.color;
o.Albedo = c.rgb * c.a;
o.Alpha = c.a;
}
ENDCG
}
Fallback "Transparent/VertexLit" }
and this is the result that I have:
Comment