opengl - Rendering translucent objects in a complex scene -
so stuck following problems scenegraphs , translucent objects... problem want render multiple translucent objects in 1 scene. know have render opaque objects first , translucent front. working well... more or less...
but real problem example have 1 translucent cube, in white (or other color) , alpha value example of 0.5. internal structure of cube given in wavefront obj file , order of single planes of cube given. dont order single planes of object because in scene >1000 objects , >1000 vertices of each object, order objects whole. if render single planes of object , move around, there comes moment, when 1 plane nearer 1 rendered before other one. , second 1 not being rendered because depth buffer not allowing this, error in rendering.
shutting down depth buffer not solution: need because there may complex objects translucent , opaque.
any hints how can achieve objects, if complex , both opaque , translucent, rendered in correct way ?
basically have following:
separate opaque , translucent (if 1 object consists of both have tear appart)
clear depth buffer
enable depth test , draw opaque.
make depth buffer read only: gldepthmask(gl_false)
draw translucent front.
that should trick.
Comments
Post a Comment