Pre-Z problem in WebGL.

Is there any one tried pre-z in WebGL?
In my solution, mesh is rendered with color write disabled and so only depthbuffer is updated in the first pass.
Next, in the second pass, the mesh is rendered again with normal rendering.
However, I got severe z-fighting effect in WebGL by performing pre-Z.

Problem has been solved. It’s seems to be my fault. :smiley:

Just wondered, does the optimization make sense?


If preZ only, it’s not worthy I think, maybe slower.
But for some technique, such as many screen based post processing algorithms, depth view must be rendered first, so preZ can be performed with it.