On 6/8/13 5:20 PM, Claude Heiland-Allen wrote:
Hi,
On 08/06/13 14:48, Matthias Kronlachner wrote:
i have a texture on a sphere and slightly add transparency to the sphere. i can now see objects behind the sphere, but is it possible to make the texture of the opposite side of the sphere visible? (through the (semitransparent) front side of the sphere)
Short answer: no.
Long answer: no, because transparency and OpenGL don't quite get along as nicely as you might expect. Rendering order (of every triangle that makes up every object) matters a great deal. Transparency involves blending the current triangle with whatever is behind it. OpenGL uses its depth buffer to keep track of what's been drawn and how far away it is at each pixel - keeping only the nearest value - whether it was rasterized before or after the previous triangle. You need to draw non-transparent stuff first, then sort every transparent triangle into depth order, possiby splitting up any transparent triangles that intersect each other into smaller triangles, then render them in order urthest from camera first, nearest to camera last. I'm pretty sure that Gem doesn't support depth sorting.
You might be able to hack it and get something that looks mostly ok some of the time by rotating the sphere to change the depth order vs render order of the triangles making up the sphere, but it will be very fragile...
Claude
thanks, i was expecting something like this. i guess i will think about an alternative approach to that instead of hacking around with depth sorting and rendering order within a single geometric object.
matthias