Hello everyone,
I’m trying to render an object in transparency. What I should do is render the same object in two different positions, in the first rendering the object should be opaque and the second rendering must be transparent.
I have tried simply to render the transparent object but I see an incorrect rendering of triangles scattered and do not understand why
My code have the depth test enabled and the pseudocode is similar to this:
glEnable (GL_BLEND);
glBlendFunc (GL_SRC_ALPHA, GL_ONE);
glColor (x, x, x, 100);
renderObject (no triangles ordered)
it looks like both objets are in exacly same place …
that would lead to so calld “z-fighting”.
Just keep in mind that a transpernt pixel still writes some depth information …
Blending can only work properbly id objects are drawn from back to front.
Can you upload a picture of a single object ? as it is hard to see were object 1 starts and 2 ends.
it looks like both objets are in exacly same place …
that would lead to so calld “z-fighting”.
Just keep in mind that a transpernt pixel still writes some depth information …
Blending can only work properbly id objects are drawn from back to front.
Can you upload a picture of a single object ? as it is hard to see were object 1 starts and 2 ends.
regards
uwi2k2[/QUOTE]
Hello uwi2k2,
in the picture you can see a single object: it’s a tooth in blending mode. Are blending wrong if I draw a single object with depth buffer enabled without
order the triangles object from back to front? All triangles object are draw with the same color and the same alpha value.
I attach another picture where I remove the code lines
/glEnable(GL_BLEND);
glBlendFunc(GL_SRC_ALPHA,GL_ONE);/
[ATTACH=CONFIG]875[/ATTACH]
ok - got it…
than you should try: glCullFace() and hide backfaces … it this works fine … than the order of the triangles it really the problem …
than you need some complex logic to order tem.
ok - got it…
than you should try: glCullFace() and hide backfaces … it this works fine … than the order of the triangles it really the problem …
than you need some complex logic to order tem.
The problem is depend from the viewer position and I can rotate the trackball in positions where I have this problem, and in positions where everything seems ok. This picture is rendered in a position where I can see this problem (GL_CULL_FACE enabled)[ATTACH=CONFIG]876[/ATTACH]