|
From: Frank C <li...@si...> - 2004-06-07 20:29:39
|
I wanted to bring this up on the list before submitting a bug... The specular highlight pass for transparent triangles waits till all the transparent triangles are drawn, then blends highlights after the fact. The problem is, the highlights are drawn on top of everything in the colour buffer, so highlights on transparent triangles that are occluded by other transparent triangles are drawn full strength when they should appear to be filtered through the triangle in front. Basically: The sort order is meaningless for the specular pass - it's all additive and always on top. The only way to get this to work properly is to draw each primitive in two passes, rather than drawing the entire set in two passes. This will undoubtedly be slower, but there are a couple things that can speed things up in general: 1). Save all the GL states between primitives and only set them when they actually need to be changed. This appears to already be the case for the specularity settings. 2). Don't bind texture "0" when turning off texturing. Just disable GL_TEXTURE2D and leave the last texture ready to be reused if the next primitive needs it (i.e. just enable GL_TEXTURE2D and don't call glBindTexture if you don't have to). This should be much faster for meshes that are mostly self-sorted and use a single texture. Doing similar things for the opaque pass to wouldn't hurt either - I see client states are cached already, which is a good start. Frank. |