- Home /
Force a custom surface shader to not compile a deferred pass?
I have a custom surface shader that requires depth information from the scene and as such cannot be rendered as part of the Deferred workflow. So like a standard transparency shader I want it to be rendered after the deferred rendering has been completed, in a forward pass.
So to force my surface shader to NOT have a deferred pass I set it up like so:
#pragma surface surf Standard vertex:vert exclude_path:deferred
Unfortunately Unity decided to ignore my exclude_path:deferred
statement and it continues to compile a deferred pass. I got some help in my Unity Forums Topic and by adding alpha
it looks like the deferred stop compiling BUT it also turned of ZWrite which I need for my shader.
I was advised to use keepalpha
instead of alpha
but the result I'm getting is that ZWrite comes back but so does the deferred pass.
How do I make this work the way I want?