开发者

Question about "Additive blending" and "Hue replacement"

开发者 https://www.devze.com 2023-02-06 00:39 出处:网络
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.

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 su开发者_StackOverflowpports 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


I have fixed it, here's the answer !

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号