   Alpha blending + Z buffering issue
  Good day,here is another problem:I am trying to make some objects look transparent and i succeeded partially...If  object A  is drawn first and then in front of it we draw object B (relatively to the camera) then object B appears transparent and we can see object A.If this is done in the reverse order, ie. object B is drawn first and we draw object A behind it, then object B is NOT transparent.I think the problem lies with the Z-Buffering. As i understand it, Z-Buffering does not draw the hidden part of object A at all, so even if B gets transparency, nothing is displayed behind it.If this is the case, one solution could probably be to re-arrange all objects which will be rendered, drawing from the farthest away from the camera first, and the closest last.I don't think however that this solves the problem at hand.I really hope there is an easier solution and someone is going to point it out.Thanx in advance,Stakon.PS. I am using Visual C++ and Direct3D9   
Quote:Original post by stakon...If this is the case, one solution could probably be to re-arrange all objects ...Correct, that's it.In OpenGL there's GL_SAMPLE_ALPHA_TO_COVERAGE_ARB as another solution, but the results aren't that nice, it's dithered. Maybe there's something similar in D3D?   ;  Thanx starvinmarvinI hope there was some such function in DirectX... at least i could try it out, because i don't think dithering will be a problem for me as i am using only geometrical shapes and no high-quality graphics.Unfortunately i haven't find a similar function in DirectX yet.PS.[off topic]I see you live in Essen...I will be visiting your town this October, to attend a convention which takes place once per year about Board Gaming[/off topic]Stakon.   ;Quote:If this is the case, one solution could probably be to re-arrange all objects which will be rendered, drawing from the farthest away from the camera first, and the closest last.I don't think however that this solves the problem at hand.You could draw the opaque objects first (preferably in a roughly front-to-back order, to make best use of the Z-buffer), then the objects that have translucency, in back-to-front order. When rendering those objects, also make sure that you render non-translucent materials first, then the translucent ones.That approach works well for me. The only problems this does not solve are those of intersecting translucent objects or concave objects. Then, you'd have to sort or even subdivide individual polygons. Personally, I think that isn't worth the effort for these rare artefacts, especially as they are quite preventable by tweaking your physics or models.   ;Quote:Original post by stakonThanx starvinmarvinI hope there was some such function in DirectX... at least i could try it out, because i don't think dithering will be a problem for me as i am using only geometrical shapes and no high-quality graphics.Unfortunately i haven't find a similar function in DirectX yet.PS.[off topic]I see you live in Essen...I will be visiting your town this October, to attend a convention which takes place once per year about Board Gaming[/off topic]Stakon.Oh really? Cool :)