I am trying to get two transparent (alpha channel) objects to overlay each other.

Two objects are created with transparent textures from 32BPP TGA files (24BPP + alpha channel).

When looking through transparent parts of the objects, any solid objects behind it will be visible, but other transparent (alpha-mapped) objects sometimes disappear, depending, apparently, on the angle.

I tried playing around with settings, giving functions different parameters in hopes of fixing the problem, but nothing works. Any suggestions anybody?

Sergey

Repentance for sin is motivated by fear of punishment rather than by love for god (c)

but i do get a strange outline on objects where things should still be a smooth aplha blend. its as if u cant see past areas that the edges of the textures alpha.This only happens at some angles- even with billboards. very odd

Well, it seems that every OpenGL based engine has the same problem, I don't know about Direct X, but the "problem" is related to the depth Z-buffer. To solve the problem I created RenderingAttributes and set setDepthBufferWriteEnable(false) on it, then I enabled sorting on Transparency attributes, and finally I set the View transparency policy to:

This fixes the problem as long as the polygons don't intersect, and as long as they are not very close to each other. Xith will sort all the polygons in the scene BACK to FRONT, but this sometimes doesn't work as expected. The way around this problem is to create bounding sphere for every transparent geometry and position them along one axis in the required order.

Sergey

Repentance for sin is motivated by fear of punishment rather than by love for god (c)

This fixes the problem as long as the polygons don't intersect, and as long as they are not very close to each other. Xith will sort all the polygons in the scene BACK to FRONT, but this sometimes doesn't work as expected.

TRANSPARENCY_SORT_BOUNDING_SPHERE _AND_EYE_RAY_INTERSECTION is a best and reasonably fast implementation I found for geometry sorting. If you have a better idea for it, lets discuss it - would be really great if we can enhance the transparency rendering [one of the approaches is to use more complicated bounding shapes, but this degrades performance very much].

To completely solve this kind of problems, we should implement some of multipass/miltiphase techniques for transparency rendering, which implements per-fragment (per-pixel) depth sorting and works perfect in every case, including intersecting polygons and self-intersecting surfaces. The good example for such technique is depth peeling, but it works efficiently only on newer hardware and requires more rendering passes.

java-gaming.org is not responsible for the content posted by its members, including references to external websites,
and other references that may or may not have a relation with our primarily
gaming and game production oriented community.
inquiries and complaints can be sent via email to the info‑account of the
company managing the website of java‑gaming.org