🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

blending/making a color-ish with a texture

Started by
2 comments, last by JoeJ 3 years, 2 months ago

how to make a color appear to be something like bluish or greenish?
example, my character mesh, will be ‘frozen’ or poisoned so it will appear ‘greenish’, in fragment shader we will already have the texture color and im confuse how to change the color to bluish or greenish and maintain or atleast leave a clue of the texture detail on it.

Seems like doing this in post render (draw the mesh twice- first normal and then colored) and blend the framebuffers is expensive so maybe it can be done in fragment shader by some mathematical formula?

finalcolor = texturecolor (op) [some kind of blue]

or something?

Advertisement

Your fragment shader can compute the tinted color with additional mostly uniform reference inputs (strength of effect, target hue) without rendering anything twice.

The crudest way is blending the “original” color from the texture with a fixed color (a medium brightness and high saturation green or blue), with a fixed weight. Of course with a high weight the texture would morph into flat blue, with a different brightness and no details.

To preserve details, you need to preserve brightness differences from the texture; for example you could apply a certain mapping to red, green and blue components of the texture sample, e.g. squashing red into a low range. Increasing green and blue would compensate brightness changes.

Omae Wa Mou Shindeiru

You may want to convert RGB to another color format like hue, saturation, brightness. It's easy this way to change hue while preserving the other two.

This topic is closed to new replies.

Advertisement