0

How can i blend diffuse texture with specular, which gL Blend function i should use and when. My specular lighting is based on special texture which has transparency. For now im just changing pixel brightness relative to alpha value and combine result with diffuse texture:

"texture(SH_MAP, TextureCoords).rgba * texture(SH_MAP, TextureCoords).a"
vec4 m_TotalColor = m_DiffuesColor + m_SpecularColor;

Is there a better way to achieve this using blending ?

1 Answers1

0

Generally the equation with light falloff is (LightColor / DistanceSquared) * (DiffuseColor + Specular)

Addition is the correct way to blend the specular and diffuse colors, as long as it's getting multiplied by the light color at some point. Keep in mind when you are working with linear color and that you convert to gamma space after all operations.

Happy shading!