Fixed sRGB for GLES renderer.

It's a bit ugly solution because we should handle it properly in one place and not add another sRGB correction... But it's already working solution and it doesn't affect the OpenGL renderer, so we can use it until better fix will be done.
Now the GLES renderer looks almost the same as the original OpenGL 3.x one :)
This commit is contained in:
Deve 2017-02-11 23:56:44 +01:00
parent e316df1807
commit 68a99fd38b
2 changed files with 8 additions and 0 deletions

View File

@ -40,7 +40,11 @@ void main(void)
col = vec4(new_color.r, new_color.g, new_color.b, col.a);
}
#ifdef GL_ES
col.xyz *= color.xyz;
#else
col.xyz *= pow(color.xyz, vec3(2.2));
#endif
float specmap = texture(SpecMap, uv).g;
float emitmap = texture(SpecMap, uv).b;
FragColor = vec4(getLightFactor(col.xyz, vec3(1.), specmap, emitmap), 1.);

View File

@ -14,6 +14,10 @@ vec3 getLightFactor(vec3 diffuseMatColor, vec3 specularMatColor, float specMapVa
vec3 DiffuseComponent = texture(DiffuseMap, tc).xyz;
vec3 SpecularComponent = texture(SpecularMap, tc).xyz;
float ao = texture(SSAO, tc).x;
#ifdef GL_ES
DiffuseComponent = pow(DiffuseComponent, vec3(1. / 2.2));
SpecularComponent = pow(SpecularComponent, vec3(1. / 2.2));
#endif
vec3 tmp = diffuseMatColor * DiffuseComponent * (1. - specMapValue) + specularMatColor * SpecularComponent * specMapValue;
vec3 emitCol = diffuseMatColor.xyz * diffuseMatColor.xyz * diffuseMatColor.xyz * 15.;
return tmp * ao + (emitMapValue * emitCol);