Jump to content
  • Advertisement

Archived

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

Shabadoo

Cheapest way to blend a colour over the entire viewport

This topic is 6017 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''m trying to blend a colour over the entire viewport to mute out the screen when the menu comes up. I tried the obvious way, draw one big alpha blended quad, but it cut the frame rate in half Is there a better way to do this or do i just have to put up with the drop in frame rate? Thanks Shabadoo

Share this post


Link to post
Share on other sites
Advertisement
you should use gourand to do this kind of stuff. It rather ads very small performace penalty so you should get away quite cheap with it. If you use gourand already for other stuff (like lighting etc) you should simple modify the final color according to your needs (for example darken it by 50%) This way you can also get a very cheap fade in/out effect and more.
Hope it helps!

PS.as Gourand I mean giving every vertex a color which is then multiplyed with the texture. Often used for lighting effects. in OpenGL you do it by giving every vertex a glColor4f(r,g,b,alpha); value while drawing. Don''t remember about d3d , but it''s really simple in both cases.

With best regards,
Mirek Czerwiñski
http://kris.top.pl/~kherin/

Share this post


Link to post
Share on other sites
take a transparent sheet of paper, color it and paste it in front of you monitor no performance change

Share this post


Link to post
Share on other sites
You''re not interested in a gradient of any sort, if I''m not mistaken, hence the Goraud comment isn''t applicable. With a 3D API, that''s really the only way to do it.

Share this post


Link to post
Share on other sites
just make sure you turn off lighting, depth test, depth write, stencil test, stencil write, and any other expensive state tests(i think that''s most of them)

other than that, you just have to take the big hit...you''re burning a lot of fill rate with this technique

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
At 1024 x 768 resolution, you''re burning 0.78 megatexels fillrate. That''s allmost *nothing* for modern 3D cards. What kind of 3d board do you have ?

BTW: the thing is called - gouraud - shading.

Share this post


Link to post
Share on other sites
Thanks for the replies, i''ve thought of a cheaper way to do it. Do the large quad once, copy the colour buffer to another location, then blit it across whenever its needed, should speed it up a lot as the scene and the quad do not need to be redrawn every frame.

Thanks
Shabadoo

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
quote:

Thanks for the replies, i''ve thought of a cheaper way to do it. Do the large quad once, copy the colour buffer to another location, then blit it across whenever its needed, should speed it up a lot as the scene and the quad do not need to be redrawn every frame.



I think, that this is going to be *a lot* slower than anything else. Blitting is always a performance killing task, and especially reading the framebuffer will kill every bit of performance left.

Do the quad method. Or if you need to fade to black (or white), you can just do it by fading the gamma correction value - that''s the cheapest fade that you can find.

Share this post


Link to post
Share on other sites
simple way

if you are using colours (such as a glcolor3f(r,g,b) multiply each one by a ratio such as the following

glcolor3f(r*ratio,b*ratio,c*ratio);


for textures, all you have to do is set the colour to ratio

glcolor3f(ratio,ratio,ratio);


this is how the blending on my small voxel engine works for the lights and stuff.


good thing is that you also don't need blending supported on your card for the people that don't have it (never seen it, but heard that some don't)

that was my 2 cents worth, if you dissagree, ignore the above stuff.




Beer - the love catalyst
good ol' homepage

Edited by - Dredge-Master on December 28, 2001 9:43:49 AM

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!