Note: I’ve edited the whole question & topic to be more direct toward my goal.
I’m trying to build a deferred rendering pipeline on Three.js.
One of the G-Buffers I need is a special depth buffer that could tell the 2nd 3rd and 4th layers behind the first depth.
The way I want to achieve this is to render without test/writing on the depth buffer So that every layer could pass the fragment shader.
One way I could think of is to call render multiple times (one per depth layer). But since my scene has a huge amount of meshes, I don’t really want to render the G-buffers in multiple render passes.
Is there any way I could achieve that in fragment shader (GLSL) or any other options around?