blending
I have a Problem with Blending.
I made a landscape Engine.
In the middle of the landscape tere is water.
Now I wanted to make the water translucend.
So I turn on blending every time when he draws the water.
The water is translucend now BUT I can see the water at every Time.
throuh every terrain and Mountain
what must I do to fix it.
March 09, 2001 10:10 AM
i guess you use OpenGL, if not, you''ll have to translate my pseudocode ;Þ
first draw your landscape, only the non transparent faces, with blending off, depth buffer read on / write on
secondly draw your water, with blending on, depth buffer read on / write off
here''s the pseudocode :
glDepthFunc(GL_LEQUAL);
glEnable(GL_DEPTH_TEST);
while(something)
{
glDepthMask(1); // read on / write on
glDisable(GL_BLEND);
draw_solid();
glDetphMask(0); // read on / write off
glEnable(GL_BLEND);
draw_water();
}
this should draw your landscape correctly, if i correctly understood your question ..
flure
first draw your landscape, only the non transparent faces, with blending off, depth buffer read on / write on
secondly draw your water, with blending on, depth buffer read on / write off
here''s the pseudocode :
glDepthFunc(GL_LEQUAL);
glEnable(GL_DEPTH_TEST);
while(something)
{
glDepthMask(1); // read on / write on
glDisable(GL_BLEND);
draw_solid();
glDetphMask(0); // read on / write off
glEnable(GL_BLEND);
draw_water();
}
this should draw your landscape correctly, if i correctly understood your question ..
flure
Yes you understood my problem correctly.
I forgot ti set the glDetphMask(0);
now it should work
I will try it
I forgot ti set the glDetphMask(0);
now it should work
I will try it
now it works!
thx
Now my water is translucend.
But is is very brigth how can I make it darker?
thx
Now my water is translucend.
But is is very brigth how can I make it darker?
hi everybody, since i''m doing the same stuff of Billi, i tried the advise you gave him , so I made a big blue transparent plane across the map, but the problem is that blending is messed up: where surface and water intersect i get nasty artifacts (blending problem i guess): this is my code from the DrawGLScene()
glDepthFunc(GL_LEQUAL);
glEnable(GL_DEPTH_TEST);
glDepthMask(1);
glDisable(GL_BLEND);
draw_surface();
glDetphMask(0);
glEnable(GL_BLEND);
draw_water();
}
what am i doing wrong ?
glDepthFunc(GL_LEQUAL);
glEnable(GL_DEPTH_TEST);
glDepthMask(1);
glDisable(GL_BLEND);
draw_surface();
glDetphMask(0);
glEnable(GL_BLEND);
draw_water();
}
what am i doing wrong ?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement