hi!
maybe someone has a suggestion for following problem in GEM:
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)
thanks matthias
Hello,
if the texture contains alpha channel by using a rgba image or by using pix_alpha, the visible parts of texture behind the sphere will become visible where front side is transparent, there is an example in gem tutorial but I don't remeber which one it is.
----- Mail original -----
De: "Matthias Kronlachner" m.kronlachner@gmail.com À: "pd-list" pd-list@iem.at Envoyé: Samedi 8 Juin 2013 15:48:21 Objet: [PD] GEM: texture on transparent sphere visible from opposite side
hi!
maybe someone has a suggestion for following problem in GEM:
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)
thanks matthias
Pd-list@iem.at mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
De: "Matthias Kronlachner" m.kronlachner@gmail.com
hi!
maybe someone has a suggestion for following problem in GEM:
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)
examples/07.texture/04.moveImages.pd
Patco
On 6/8/13 5:16 PM, Patrice Colet wrote:
De: "Matthias Kronlachner" m.kronlachner@gmail.com hi!
maybe someone has a suggestion for following problem in GEM:
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)
examples/07.texture/04.moveImages.pd
Patco
thanks, but this is not what i want. as i have one sphere and the texture of the back side should be visible through the front side.
matthias
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...
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
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@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