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

Jack jack at rybn.org
Tue Jun 11 17:26:40 CEST 2013


Le 09/06/2013 08:48, Matthias Kronlachner a écrit :
> 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
>
>
> _______________________________________________
> Pd-list at iem.at mailing list
> UNSUBSCRIBE and account-management ->
> http://lists.puredata.info/listinfo/pd-list

Hello,

I think it should be doable using culling (GL_FRONT and GL_BACK). But,
in this case, you need to render two times the sphere (one with culling
GL_FRONT and the other with culling GL_BACK) and then adjust alpha
between them.
++

Jack





More information about the Pd-list mailing list