Stencil test performance question

Node-based Shader Editor
Post Reply
mossman
Posts: 40
Joined: Sun Dec 10, 2017 3:58 pm

Stencil test performance question

Post by mossman »

Hello,

I want to know if a shader without a stencil test consumes less than a shader with a stencil test with default values (
Ref 0, ReadMask 255, WriteMask 255, Comp always, Pass keep, Fail keep, ZFail keep) or is the same.

Thanks
User avatar
Amplify_Borba
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Stencil test performance question

Post by Amplify_Borba »

Hey there, performance will always depend on the shader's complexity, features used and the target device, so the most accurate answer you can get is by testing the shader on your target hardware and measure what happens.
You can use the RenderDoc and GPUOpen tools to benchmark your shaders, or even Unity's frame debugger, as it can be hard to predict how certain operations would perform under different shader types.

Specifically regarding Stencil, in some cases you can gain performance by discarding pixels as they won't have any further operations performed on them, however, this might not always be the case.
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
mossman
Posts: 40
Joined: Sun Dec 10, 2017 3:58 pm

Re: Stencil test performance question

Post by mossman »

Ok Many thanks is very useful.
User avatar
Amplify_Borba
Posts: 1239
Joined: Mon Jul 24, 2017 9:50 am

Re: Stencil test performance question

Post by Amplify_Borba »

No problem, always happy to help!
Customer Relations at Amplify Creations
Learn more about our offering: Amplify Creations Products
Amplify Shader Editor won the Asset Store Best Tool Award - Thank you for your support!
Post Reply