transparency

Started by
2 comments, last by BlimeyOReilly 20 years ago
hi people! ive got a problem that i dont know how to solve. This is the scenario. I have a spaceship that the player controls...when the player hits an enemy object, its shields come up represented by a sphere quadric. i have blended the texture on this sphere so it is transparent...problem is it wont render anything within the sphere...yet the sphere is transparent to things behind it. Is there anyway to make the spaceship render within the sphere?
Advertisement
To make this work properly, you''ll have to draw what''s in the sphere first, then draw the faces of the sphere from back to front. Since you''re using a quadric, this second step may be impossible, but you at least need to render the contained object (with depth testing enabled) before the transparent container (with depth testing disabled).

Later,
ZE.

//email me.//zealouselixir software.//msdn.//n00biez.//
miscellaneous links

[twitter]warrenm[/twitter]

Need more information. What are your blending parameters and in what order are you rendering the ship and sphere?

EDIT: My own solution for rendering an object enclosed by a transparent object is as follows:

Set blending to GL_SRC_ALPHA and GL_ONE_MINUS_SRC_ALPHA. Next, turn on front-face culling and draw the enclosing, transparent object. This will draw the back of the object only. Next, switch face culling to back-face culling and draw the enclosed object, then the enclosing object again.

[edited by - Ostsol on March 29, 2004 6:56:35 PM]
-Ostsol
cheers guys, did the trick!

This topic is closed to new replies.

Advertisement