We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpOpenGL and 3D Libraries › P3D tranlucent texture
Page Index Toggle Pages: 1
P3D tranlucent texture (Read 1127 times)
P3D tranlucent texture
Feb 1st, 2006, 5:22pm
 
Hey, I have a model that is loaded from a file and drawn every frame with all the tris being dumped in between beginShape and endShape calls. It works wonderfully except that when i assign it a texture with a partial transparancy, the Z order of all of the polys seems to go completely haywire with some faces seeming to be completely missing.
This works fine in OpenGL, so this is a problem only in P3D. Am I supposed to keep track of my own Z-ordering when i do this or is this a bug?
Re: P3D tranlucent texture
Reply #1 - Feb 3rd, 2006, 5:35pm
 
hmm, ive been messing around with it... is there a reason why zbuffering is completely turned off when there is an alpha channel texture involved?
I wouldnt mind drawing alpha mapped polygons last, but manually sorting ALL polygons when there is already a zbuffer seems crazy.
If one of you good people could point me in the right direction towards being able to render alpha correctly in P3D, I would be much obliged.
Re: P3D tranlucent texture
Reply #2 - Feb 6th, 2006, 1:01pm
 
Unfortunately, P3D isn't the most advanced 3D engine ever. It does everythign most people need, but not everything that everyone would ever need. Casey and Ben only have so many hours they can put into processing and getting most things to work for most people is more important than one thing to work for everyone I think.

The problem with transparent polygons and the zbuffer is that you would need multiple z-buffers to work out things correctly.

Assume you have a poly behind a transparent poly, then want to draw a third poly that intersects BOTH of the current ones. If you have written to the z-buffer with the transparent poly, you can't work out the intersect with the behind poly. If you use the behind poly, you can't work out the intersect with the transparent one...

So I think the only option is that your program needs to have some logic in to sort the polys into drawing order first so that you get the right result.
Re: P3D tranlucent texture
Reply #3 - Feb 6th, 2006, 1:46pm
 
I'm not sure if there are additional issues with P3D, but depth-sorting polygons in 3D engines is actually quite common.  In OpenGL with alpha blending enabled the drawing order does matter. Sections 10.2 and 10.3 here deal with some of the issues:

http://www.opengl.org/resources/tutorials/advanced/advanced97/notes/node109.html
Re: P3D tranlucent texture
Reply #4 - Feb 6th, 2006, 3:16pm
 
this is also covered by this item in the bugs db:
http://dev.processing.org/bugs/show_bug.cgi?id=176

it's noted in the faq, though was listed only as an opengl issue. i've moved it to the "common issues" section.
Re: P3D tranlucent texture
Reply #5 - Feb 6th, 2006, 5:14pm
 
Hey guys thanks for the replies.

I am familiar with depth sorting and the zbuffer issues with alpha enabled textures having done some OpenGL stuff in the past. My problem is that while in OpenGL, for example, incorrect order would cause the alpha to show incorrect blending results for the translucent polygons, the rest of the scene being very much intact, in P3D, the zbuffer seems to be turned off COMPLETELY once there is an alpha channel involved, rendering everything incorrect.

I don't understand why that is necessary or how to disable it, i tried the noHint on the no zbuffer flag (sorry forget what its called) and it didnt seem to have any effect.
Page Index Toggle Pages: 1