diff --git a/PCloud_Util.cginc b/PCloud_Util.cginc index 9d6a614..15c1db8 100644 --- a/PCloud_Util.cginc +++ b/PCloud_Util.cginc @@ -4,6 +4,7 @@ #include "noiseSimplex.cginc" #define SCALE 300.0 // Word coordinate range +#define CAMCLIP -0.00390625f // special(non-approximated) camera near clip value float pos2color(float p) { diff --git a/sh_PCloud_Main.shader b/sh_PCloud_Main.shader index 636bcbd..8b7ec05 100644 --- a/sh_PCloud_Main.shader +++ b/sh_PCloud_Main.shader @@ -17,8 +17,8 @@ SubShader Tags { "Queue"="Overlay+1000" "IgnoreProjector"="True" "RenderType"="Overlay" "PreviewType"="Plane" "DisableBatching"="True" } Blend Off //Cull Off - ZWrite Off - //ZTest Always + ZWrite On + ZTest Always ColorMask RGBA Pass @@ -54,11 +54,11 @@ SubShader fs_in vert(float4 vertex : POSITION) { // TODO place vertices at camera near clip - // TODO 2 examine camera(clip?) to identify render target and hide - // if its not the target,so its not rendered for players and etc fs_in o; o.pos = UnityObjectToClipPos(vertex); o.uv = ComputeScreenPos(o.pos); + if (_ProjectionParams.y != CAMCLIP) // hide other cameras players + o.pos = float4(0,0,0,0); return o; } diff --git a/sh_PCloud_Pass.shader b/sh_PCloud_Pass.shader index 871dfeb..65dc197 100644 --- a/sh_PCloud_Pass.shader +++ b/sh_PCloud_Pass.shader @@ -11,8 +11,8 @@ SubShader Tags { "Queue"="Overlay+1000" "IgnoreProjector"="True" "RenderType"="Overlay" "PreviewType"="Plane" "DisableBatching"="True"} Blend Off //Cull Off - ZWrite Off - //ZTest Always + ZWrite On + ZTest Always ColorMask RGBA Pass @@ -32,6 +32,8 @@ SubShader float4 vert(float4 vertex : POSITION) : SV_Position { // TODO place vertices at camera near clip + if (_ProjectionParams.y != CAMCLIP) // hide other cameras players + return float4(0,0,0,0); return UnityObjectToClipPos(vertex); }