- Home /
Custom Shader Queues not fully working with Deferred Shading?
The following effect is created using a combination of custom shader queues and Z-buffer tricks. The environment "within" the book is entirely geometry, and is being drawn conventionally, but the space environment and the book itself are being drawn onto a second camera, which renders after the first camera using clear mode "Depth Only". The books pages use a custom shader that doesn't actually write any color, only Z-depth, and operates in a lower queue to ensure the pages get drawn to the Z-buffer first. Then all of the other objects in the space environment are drawn in the conventional geometry queue such that pixels behind the pages fail the depth test, and leave a transparent area, an open window, to the image from the first camera.
HOWEVER, this only works if the second camera is set to use Forward Rendering. If the second camera is set to use Deferred rendering, then the book cover, which is being rendered using the Standard shader, seems to be drawn before the pages, breaking the effect. Either the Shader Queue is not being respected and objects are being drawn out-of-order, or the Z-buffer is not being respected. Note that there's a small gap where the book pages meet the Skybox shader - is there some difference between the way the Skybox and Standard shaders behave in Deferred rendering? Any answers would be appreciated.
Your answer
Follow this Question
Related Questions
Creating a Masking Object with Variable Pass Through 0 Answers
Force a custom surface shader to not compile a deferred pass? 0 Answers
Cutting hole in water plane using stencil buffer.Help making it visible from both sides. 0 Answers
Why CYAN is default object color (with default materials & shaders) 0 Answers
How to not have custom node variables be global across all material instances 0 Answers