[PD] GEM: texture on transparent sphere visible from opposite side

Claude Heiland-Allen claude at mathr.co.uk
Sat Jun 8 16:20:43 CEST 2013


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...


More information about the Pd-list mailing list