bc6ff38b22
In this case only diffuseMatColor really matters, other values are constant. It improves performance on GLES renderer and it's also noticeably faster for GL on desktop. For example: - fps increased for me from 60 to 69 on Hacienda with intel HD 4000 - from 43 to 49 on lighthouse There is much less difference on nvidia graphics card, but still it gives small performance improvement.
29 lines
1.0 KiB
GLSL
29 lines
1.0 KiB
GLSL
#ifdef Use_Bindless_Texture
|
|
layout(bindless_sampler) uniform sampler2D DiffuseMap;
|
|
layout(bindless_sampler) uniform sampler2D SpecularMap;
|
|
layout(bindless_sampler) uniform sampler2D SSAO;
|
|
#else
|
|
uniform sampler2D DiffuseMap;
|
|
uniform sampler2D SpecularMap;
|
|
uniform sampler2D SSAO;
|
|
#endif
|
|
|
|
vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapValue, float emitMapValue)
|
|
{
|
|
#if defined(Advanced_Lighting_Enabled)
|
|
vec2 tc = gl_FragCoord.xy / screen;
|
|
vec3 DiffuseComponent = texture(DiffuseMap, tc).xyz;
|
|
vec3 SpecularComponent = texture(SpecularMap, tc).xyz;
|
|
float ao = texture(SSAO, tc).x;
|
|
vec3 tmp = diffuseMatColor * DiffuseComponent * (1. - specMapValue) + specularMatColor * SpecularComponent * specMapValue;
|
|
vec3 emitCol = diffuseMatColor.xyz * diffuseMatColor.xyz * diffuseMatColor.xyz * 15.;
|
|
return tmp * ao + (emitMapValue * emitCol);
|
|
#else
|
|
#if defined(GL_ES)
|
|
return diffuseMatColor * 0.73; // 0.5 ^ (1. / 2.2)
|
|
#else
|
|
return diffuseMatColor * 0.5;
|
|
#endif
|
|
#endif
|
|
}
|