• Advertisement

Archived

This topic is now archived and is closed to further replies.

Blending Factors

This topic is 5412 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

i want to make some shadows (raycasting on the ground plane). when i draw the shadow triangles with blending and 0.5 alpha, two overlapping triangles will overbrighten the shadow. what blending func shoul i use so the shadow looks nice?

Share this post


Link to post
Share on other sites
Advertisement
Just use the alpha value of that triangle color.

Be sure to enable the alpha channel blending:

glEnable(GL_ALPHA_TEST); // enable alpha testing
glAlphaFunc(GL_GEQUAL, 0.05f); // if alpha < 0.05, don''t draw pixel
glColor4f(0.0f, 0.0f, 0.0f, 0.5f); // black with 50% blending

Share this post


Link to post
Share on other sites
I have a feeling you might be rendering the blended rectangle over the screen more than once, (if you are using a method similar to nehe)

Make sure you draw shadows last, ie.

1. draw everything

2. Enable the start bit of shadows.
3. Do the shadow passes on every object

4. Draw one blended rectange

Hope this answers the question.

Share this post


Link to post
Share on other sites

  • Advertisement