Skip to main content
GameDev.net gamedev.net
🔒 Locked

Blending and depth testing question

Started by Canazza Apr 16, 2006 at 1:29 PM 0 replies 650+ views
Original Post
Canazza
Canazza
Hi there, i've been having some trouble recently with openGL. I'm modeling a solar system and i'm currently trying to render the sun. It's going to be 2 or 3 quads with a single texture on it, blended against the backdrop. a bit like this: http://img.photobucket.com/albums/v626/Canazza/2quads.gif my problem is that although each face blends with the backdrop and the planets, the second/third ones does not blend with the other ones. unless, i turn off depth testing, in which case, it isn't blocked by the planets. any help?
clb
clb
Well that's the general problem of transparency... The Z-Buffer doesn't represent translucent objects any way, so you need to sort your alpha-enabled objects back to front and render without alpha writing on (alpha tests can be on). So your render order should be:

1. Render opaque objects with zwrites and ztesting on.(perhaps sorting front to back)
2. Render transparent objects with zwrites off and ztesting on (sorting back to front, to avoid artifacts)

NVidia has some sample of Order-Independent-Transparency, but I haven't looked into it if it could handle the case.

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.