fix stencil pass
This commit is contained in:
@@ -1,21 +1,16 @@
|
||||
Shader "Escape Room Engine/FullScreenDepth" {
|
||||
Properties {
|
||||
_PortalNumber ("Portal Number", Int) = 1
|
||||
}
|
||||
Properties {}
|
||||
|
||||
SubShader {
|
||||
Pass
|
||||
{
|
||||
Pass {
|
||||
ColorMask 0
|
||||
Cull Off
|
||||
ZWrite On
|
||||
ZTest Always
|
||||
|
||||
Stencil
|
||||
{
|
||||
Ref [_PortalNumber]
|
||||
Comp Equal // pass if equal
|
||||
Pass Keep // keep stencil value
|
||||
Fail Keep // keep stencil if depth fails
|
||||
Stencil {
|
||||
Ref 1
|
||||
Comp LEqual
|
||||
}
|
||||
|
||||
CGPROGRAM
|
||||
@@ -23,18 +18,16 @@
|
||||
#pragma fragment frag
|
||||
#include "UnityCG.cginc"
|
||||
|
||||
void vert(appdata_img v, out float4 pos : SV_POSITION)
|
||||
{
|
||||
#ifdef UNITY_REVERSED_Z
|
||||
void vert(appdata_img v, out float4 pos : SV_POSITION) {
|
||||
#ifdef UNITY_REVERSED_Z // clip space [near 1, 0 far]
|
||||
float far = 0.00001;
|
||||
#else
|
||||
#else // clip space [near -1, 1 far]
|
||||
float far = 0.99999;
|
||||
#endif
|
||||
pos = float4(v.vertex.xy * 2.0, far, 1); // quad xy goes from -0.5 to 0.5, clip space from -1 to 1
|
||||
}
|
||||
|
||||
fixed4 frag() : SV_Target
|
||||
{
|
||||
fixed4 frag() : SV_Target {
|
||||
return 0;
|
||||
}
|
||||
ENDCG
|
||||
|
||||
@@ -25,6 +25,6 @@ Material:
|
||||
m_TexEnvs: []
|
||||
m_Ints: []
|
||||
m_Floats:
|
||||
- _PortalNumber: 1
|
||||
- _PortalNumber: 0
|
||||
m_Colors: []
|
||||
m_BuildTextureStacks: []
|
||||
|
||||
@@ -1,23 +1,13 @@
|
||||
Shader "Escape Room Engine/PortalStencil"
|
||||
{
|
||||
Properties
|
||||
{
|
||||
_PortalNumber ("Portal Number", Int) = 1
|
||||
Shader "Escape Room Engine/PortalStencil" {
|
||||
Properties {
|
||||
_PortalNumber ("Portal Number", Int) = 0
|
||||
}
|
||||
|
||||
SubShader
|
||||
{
|
||||
Tags
|
||||
{
|
||||
"RenderType"="Opaque" "RenderPipeline" = "UniversalPipeline"
|
||||
}
|
||||
SubShader {
|
||||
Pass {
|
||||
ColorMask 0 // don't draw this to the main framebuffer
|
||||
|
||||
Pass
|
||||
{
|
||||
ColorMask 0
|
||||
|
||||
Stencil
|
||||
{
|
||||
Stencil {
|
||||
Ref [_PortalNumber]
|
||||
Comp Always // always pass
|
||||
Pass Replace // set stencil value
|
||||
|
||||
Reference in New Issue
Block a user