PDA

View Full Version : Transparent? very urgent! need help!



hugo
09-18-2002, 10:41 PM
I draw a scene, i dont want to use transparent. but when look near objects are opacue, and when look far away they become transparent!! why?????

JML
09-18-2002, 10:48 PM
If by 'look far' you mean they seem to disappear when they are moved further away from the camera, you should try to increase the 'far' value in your call to glOrtho, glFrustum or gluPerspective.

OpenGL clips objects when they are closer to the camera than the 'near' value and also when they are further away than the 'far' value.

HTH

Jean-Marc.

hugo
09-18-2002, 10:55 PM
sorry, u hv misunderstood me.
i hv give a big value to zfar (about 200000).
well, my question is:
when looking far, the object near me become transparent, that is to say i can see the objects behind the nearer object. but when make that nearer object nearer to me, then i will not see the objects behind this nearer object.
any help is greatly appreciated!!!!

JML
09-18-2002, 11:00 PM
Ok, in that case, perhaps you are experiencing z-fighting.

What are your near and far values? (BTW you do have a depth buffer and have depth testing correctly enabled?)

Are you aware that in perspective mode the ratio far / near has an impact on the accuracy of the depth buffer; especially closer to the far edge? You should try to keep the far/near ratio below 1000. For a far value of 200000 the near value should therefor be at least 200 (YMMV).

HTH

Jean-Marc

Mazy
09-18-2002, 11:29 PM
I think you have a sort problem
If you draw the transparent object first you fill the z-buffer with 'near' values and therefor you cant draw anything behind it..
you should always draw transparent object last and in reverse Z-order ( objects far away first)

hugo
09-18-2002, 11:42 PM
Thank you !dear JML!
you save me a lot.