vec3 srgb_to_linear(vec3 color)
{
bvec3 near_zero = lessThan(color, vec3(0.04045));
- vec3 gamma = pow((color.rgb+0.055)/1.055, vec3(2.4));
- return mix(color.rgb/12.92, gamma, near_zero);
+ vec3 gamma = pow((color+0.055)/1.055, vec3(2.4));
+ return mix(color/12.92, gamma, near_zero);
}
vec4 srgb_to_linear(vec4 color)
{
{
vec4 color = texture(tex, _vs_out_texcoord);
vec3 _srgb_to_linear_color = color.rgb;
- frag_color = vec4(mix(_srgb_to_linear_color.rgb/12.92, pow((_srgb_to_linear_color.rgb+0.055)/1.055, vec3(2.4)), lessThan(_srgb_to_linear_color, vec3(0.04045))), color.a);
+ frag_color = vec4(mix(_srgb_to_linear_color/12.92, pow((_srgb_to_linear_color+0.055)/1.055, vec3(2.4)), lessThan(_srgb_to_linear_color, vec3(0.04045))), color.a);
}
*/