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

Blending

Started by Infuscare Nov 26, 2003 at 11:53 AM 2 replies 350+ views
Original Post
Infuscare
Infuscare
First off, I just want to say I have the book "game programming with openGL", and I didnt finnish the chapter on blending, but anyway. On the NeHe tutorial for blending, he says to disable the depth buffer to enable blending, in the book, they say to enable the depth mask. When I enable the depth mask, I looks really weird when I set it from transparent to solid. Disbling the depth buffer works fine, but when I added fog, the model became white (when the depth mask is disabled)... I don''t get it... Can some1 explain why it does this and how to fix it? _________________________________________ "Why, why why does everyone ask ''''why'''' when ''''how'''' is so much more fun" -Spawn 1997
___________"You're just jelous because the voices only talk to me"
Trienco
Trienco
if you disable the depth mask it wont write to the zbuffer, which is more or less what you want for transparent objects (that you draw AFTER all solid geometry). disabling the whole depth test would let your transparent geometry draw over solid geometry that is in front of it (not what you want).

of course disabling depth mask for solid stuff will look weird if it doesnt happen to draw back to front.
f@dzhttp://festini.device-zero.de
Infuscare
Infuscare
In my scene, I have only one object that I can set to blend or to solid. When I make it transparent using the depth mask, it looks fine, but when I take off the depth mask (when I write to the depth buffer) my object becomes all weird with some places that are black, and others that show the triangles that compose the quads, etc...

I could post the code or an executable, but my code isn't very clear (I dont think). I'm just trying to make a class to encapsulate some OpenGL functionality... I'll post some of the code later because I can't right now...

But now that I think about it, you can't use fog without depth testing, thats what fog is based on, so my new question is, how can you make an object transparent with fog in the scene...?

[edited by - Infuscare on November 27, 2003 10:17:42 AM]
___________"You're just jelous because the voices only talk to me"
Infuscare
Infuscare
some1 please? how do you use transparency and fog at the same time?

_________________________________________
"Why, why why does everyone ask ''''why'''' when ''''how'''' is so much more fun"
-Spawn 1997
___________"You're just jelous because the voices only talk to me"

Topic Locked

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

Sign in to reply to this topic.