alkiem
10-24-2005, 10:30 AM
Hi,
i want to render my scene in two passes to improve z-culling of "shadered" pixels:
1) render scene, only depth writing, no shaders.
2) render scene, only color writing, with shaders.
(depth test always enable)
So my code in OpenGL looks like this:
glDepthFunc(GL_LEQUAL);
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
RenderScene();
glDepthMask(GL_FALSE);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
//I enable my shader program
RenderScene();
//I disable my shader program
If i render everything in one pass, all is ok. If using this 2 passes method, it seems that many pixels are z-culled when they shouldn't. It seems as if in the second pass the same pixel has not exactly the same depth.
And i've tried to do both pass with fixed pipeline or with shaders, but i've got the same result. Please, if someone has an idea or know a better way to achieve my purpose.
Thanks in advance.
i want to render my scene in two passes to improve z-culling of "shadered" pixels:
1) render scene, only depth writing, no shaders.
2) render scene, only color writing, with shaders.
(depth test always enable)
So my code in OpenGL looks like this:
glDepthFunc(GL_LEQUAL);
glEnable(GL_DEPTH_TEST);
glDepthMask(GL_TRUE);
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE);
RenderScene();
glDepthMask(GL_FALSE);
glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
//I enable my shader program
RenderScene();
//I disable my shader program
If i render everything in one pass, all is ok. If using this 2 passes method, it seems that many pixels are z-culled when they shouldn't. It seems as if in the second pass the same pixel has not exactly the same depth.
And i've tried to do both pass with fixed pipeline or with shaders, but i've got the same result. Please, if someone has an idea or know a better way to achieve my purpose.
Thanks in advance.