Hello everybody,
I think there is a possible issue with the following code (RenderQueue.java) :
private void renderTransparentBucket() {
transparentBucket.sort();
for (int i = 0; i < transparentBucket.listSize; i++) {
SceneElement obj = transparentBucket.list;
if (twoPassTransparent && obj instanceof GeomBatch) {
GeomBatch batch = (GeomBatch)obj;
RenderState oldCullState = batch.states[RenderState.RS_CULL];
batch.states[RenderState.RS_CULL] = tranCull;
ZBufferState oldZState = (ZBufferState)batch.states[RenderState.RS_ZBUFFER];
batch.states[RenderState.RS_ZBUFFER] = tranZBuff;
// first render back-facing tris only
tranCull.setCullMode(CullState.CS_FRONT);
obj.draw(renderer);
// then render front-facing tris only
batch.states[RenderState.RS_ZBUFFER] = oldZState;
tranCull.setCullMode(CullState.CS_BACK);
obj.draw(renderer);
batch.states[RenderState.RS_CULL] = oldCullState;
} else {
// draw as usual
obj.draw(renderer);
}
obj.queueDistance = Float.NEGATIVE_INFINITY;
}
transparentBucket.clear();
}
When rendering transparents meshes with the two pass transparency activated, if no front faces cover a back face, the ZBuffer is never updated because the "tranZBuff" disable the ZBuffer writing: the tranZBuff is initialized with setWritable(false); So, the objects that are drawn after can cover those faces even if their Z is greater.
Is the tranZBuff.setWritable(false); really useful ? What is it needed for ?
(Setting the tranZBuff.setWritable(); to true seems to solved my display problem...)
Thanks! :)