noony Posted April 30, 2019 Share Posted April 30, 2019 We have a few shaders using the stencil buffer to create masks, and portal-like effects. These work fine with single-pass rendering disabled on Unity 2018.2, but with single-pass forced on, the stencil buffer seems to be ignored and the objects render as regular opaque renderers. Although experimental, we're fairly reliant on single-pass for performance reasons, so turning it off is not feasible at this stage. Has anybody else managed to use a stencil buffer effect under single-pass rendering? Is this expected behaviour for the current state of single-pass ? Link to comment Share on other sites More sharing options...
Tony PH Lin Posted May 2, 2019 Share Posted May 2, 2019 Hi , Could you let us know the names if we can purchase or get these Shader from Asset Store? We'd like to try as experiment then we may make some feedbacks. Thanks. Link to comment Share on other sites More sharing options...
noony Posted May 2, 2019 Author Share Posted May 2, 2019 Hi The shaders are custom, written by ourselves as part of the project. The actual shaders are quite complex, but I've attached below simplified versions that demonstrate the same issue. UnlitStencil draws an object in blue with stencil set to 1; StencilMask should cause any renderer to mask the previous object when occupying the same pixels. This works fine in the editor scene view, and on device with single-pass off, but with single-pass on, no mask effect is seen, as if the stencil buffer is being ignored. Thanks for the help! Shader "UnlitStencil"{ SubShader { Tags { "RenderType"="Opaque" } Stencil { Ref 1 Comp NotEqual Pass Keep Fail Keep } Pass { CGPROGRAM #pragma vertex vert #pragma fragment frag struct appdata { float4 vertex : POSITION; }; struct v2f { float4 vertex : SV_POSITION; }; v2f vert (appdata v) { v2f o; o.vertex = UnityObjectToClipPos(v.vertex); return o; } fixed4 frag (v2f i) : SV_Target { return half4(0, 0, 1, 1); } ENDCG } }} Shader "StencilMask"{ SubShader { Tags { "RenderType"="Opaque" "Queue"="Geometry-100"} ColorMask 0 ZWrite Off Stencil { Ref 1 Comp Always Pass Replace } Pass { CGPROGRAM #pragma vertex vert #pragma fragment frag struct appdata { float4 vertex : POSITION; }; struct v2f { float4 vertex : SV_POSITION; }; v2f vert(appdata v) { v2f o; o.vertex = UnityObjectToClipPos(v.vertex); return o; } half4 frag(v2f i) : COLOR { return 0; } ENDCG } }} Link to comment Share on other sites More sharing options...
Tony PH Lin Posted May 22, 2019 Share Posted May 22, 2019 Hi , We've found that Stencil buffer isn't supported on current Single pass. The new code is added and under verified, and plan into our next release which target in mid of July. Thanks for your great inputs and feedbacks. Link to comment Share on other sites More sharing options...
noony Posted July 1, 2019 Author Share Posted July 1, 2019 Hi , Is this update fixing stencil buffer support for single-pass still on course for July? Would you have a more precise release date now, and is it likely to be an SDK or ROM update to look out for? Thanks! Link to comment Share on other sites More sharing options...
Tony PH Lin Posted July 4, 2019 Share Posted July 4, 2019 Hi , The new Wave SDK 3.1 version is planned to release around the end of July, and this issue fix is inside. It includes ROM code upgrade on your device, and also SDK to build your new contents. Thanks. Link to comment Share on other sites More sharing options...
noony Posted July 29, 2019 Author Share Posted July 29, 2019 Hi @Tony PH Lin Just bumping this thread to check that the SDK update is still on course for July? Thanks! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.