1

While using some 3D models the depth Mask Shader which is having z-test as "LEqual" need to perform normally as in screenshot1

screenshot1

But it give result which shows grayscale outlined of that part of 3d model where it need to be hidden. [Take reference of screenshot2]

screenshot2

We have tried changing the ZTest from LEqual to Always which solves the problem a bit but again the object is partially visible.

Shader "Custom/mask" { 
SubShader { 
Tags {
"Queue" = "Geometry+10" 
"RenderType" = "Opaque" 
}

Lighting Off 
ZTest LEqual 
Cull Back 
ZWrite On 
ColorMask 0 
Blend One One 
Pass {Fog {Mode Off}}

} } 
Praful Sharma
  • 21
  • 1
  • 8

1 Answers1

0

Seems like you do an early Z-pass from the occluding mesh, which I guess is a reconstructed or motion tracked face? so the glasses are rendered with a standard material correct?

The mask material needs to be drawn early so the queue should be Geometry-10 or something. All the other tags are irrelevant except ColorMask 0 .

Lighting and Fog are deprecated and Blend is of no use since you don't draw to the color buffer anyway (using ColorMask 0 it only draws the depth).

Brice V.
  • 861
  • 4
  • 7