Skip to content

Commit

Permalink
Hide compute meshes from other cameras
Browse files Browse the repository at this point in the history
  • Loading branch information
lukis101 committed Jul 30, 2018
1 parent f9a6d54 commit 7990544
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions PCloud_Util.cginc
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
8 changes: 4 additions & 4 deletions sh_PCloud_Main.shader
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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;
}

Expand Down
6 changes: 4 additions & 2 deletions sh_PCloud_Pass.shader
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
}

Expand Down

0 comments on commit 7990544

Please sign in to comment.