Question about “Additive blending” and “Hue replacement”

爷,独闯天下 提交于 2019-12-23 05:49:07

问题


Since drawing fonts is quite expensive in terms of CPU, many developers use a rasterized font to draw text on video games; that's what I did too.

Using additive blending when drawing the text works fine regarding glyph edges, these merge nicely with the background color.

But it brought another issue,

I decided to implement a 'color' parameter for drawing the font, instead of producing glyphs bitmaps for each color, otherwise memory usage might be an issue soon; depending how many glyphs and colors are needed but also the font size and since it supports Unicode, there can be thousands of glyphs needed depending the language.

Now when I blend, say a 'Green' font on a 'Red' background, it goes 'Orange' ! Which is the purpose of additive blending, but trying to bypass this went a little more complicate than expected. Obviously it doesn't happen when background is 'Black' but it might not be that color in the end.

How can I recolor my 'White' font to 'Any' color, while still retaining additive blending over 'Any' color ?

Thanks a lot :D


回答1:


I have fixed it, here's the answer !



来源:https://stackoverflow.com/questions/4750290/question-about-additive-blending-and-hue-replacement

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!