Projects
AGS Engine | Graphics | Change tinting to multiplicative blending. |
---|---|---|
Calin Leafshade | Currently the tinting algorithm uses 5 values (r,g,b,saturation and luminance). This is unnecessary, slow and unintuitive. The saturation and luminance of the tint colour should be contained within the RGB values and it makes no sense to have these extra values affect the RGB color given. On top of that the saturation value affects the degree of the effect of the luminance value so it's impossible to partially apply the color and fully apply the luminance value (for normal darkness). Simple multiplicative blending is faster and solves all these issues. It's as simple as multiplying the source color by the tint color: [code=glsl] vec4 col = Texture2D(source, texture_coords) * tintCol; [/code] [code=c] r = r * tintR; g = g * tintG; b = b * tintB; [/code] |