pbr load as srgb + gamma correction tweaks
parent
9ed0c978a3
commit
cde29d5a5a
|
@ -209,9 +209,12 @@ surface_t surface() {
|
||||||
float c = 2.43f;
|
float c = 2.43f;
|
||||||
float d = 0.59f;
|
float d = 0.59f;
|
||||||
float e = 0.14f;
|
float e = 0.14f;
|
||||||
vec3 color = clamp((x*(a*x+b))/(x*(c*x+d)+e), 0.0, 1.0);
|
// vec3 color = clamp((x*(a*x+b))/(x*(c*x+d)+e), 0.0, 1.0);
|
||||||
|
vec3 color = x / ( vec3(1.) + x );
|
||||||
// gamma correction
|
// gamma correction
|
||||||
|
|
||||||
s.fragcolor.rgb = pow( color, vec3(1.0/2.2) );
|
s.fragcolor.rgb = pow( color, vec3(1.0/2.2) );
|
||||||
|
// s.fragcolor.rgb = pow(s.fragcolor.rgb, vec3(1.0/2.2) );
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -384602,8 +384602,8 @@ bool colormap( colormap_t *cm, const char *texture_name, bool load_as_srgb ) {
|
||||||
FREE(cm->texture), cm->texture = NULL;
|
FREE(cm->texture), cm->texture = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// int srgb = load_as_srgb ? TEXTURE_SRGB : 0;
|
int srgb = load_as_srgb ? TEXTURE_SRGB : 0;
|
||||||
int srgb = 0;
|
// int srgb = 0;
|
||||||
int hdr = strendi(texture_name, ".hdr") ? TEXTURE_FLOAT|TEXTURE_RGBA : 0;
|
int hdr = strendi(texture_name, ".hdr") ? TEXTURE_FLOAT|TEXTURE_RGBA : 0;
|
||||||
texture_t t = texture_compressed(texture_name, TEXTURE_LINEAR | TEXTURE_ANISOTROPY | TEXTURE_MIPMAPS | TEXTURE_REPEAT | hdr | srgb);
|
texture_t t = texture_compressed(texture_name, TEXTURE_LINEAR | TEXTURE_ANISOTROPY | TEXTURE_MIPMAPS | TEXTURE_REPEAT | hdr | srgb);
|
||||||
|
|
||||||
|
|
|
@ -2945,8 +2945,8 @@ bool colormap( colormap_t *cm, const char *texture_name, bool load_as_srgb ) {
|
||||||
FREE(cm->texture), cm->texture = NULL;
|
FREE(cm->texture), cm->texture = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// int srgb = load_as_srgb ? TEXTURE_SRGB : 0;
|
int srgb = load_as_srgb ? TEXTURE_SRGB : 0;
|
||||||
int srgb = 0;
|
// int srgb = 0;
|
||||||
int hdr = strendi(texture_name, ".hdr") ? TEXTURE_FLOAT|TEXTURE_RGBA : 0;
|
int hdr = strendi(texture_name, ".hdr") ? TEXTURE_FLOAT|TEXTURE_RGBA : 0;
|
||||||
texture_t t = texture_compressed(texture_name, TEXTURE_LINEAR | TEXTURE_ANISOTROPY | TEXTURE_MIPMAPS | TEXTURE_REPEAT | hdr | srgb);
|
texture_t t = texture_compressed(texture_name, TEXTURE_LINEAR | TEXTURE_ANISOTROPY | TEXTURE_MIPMAPS | TEXTURE_REPEAT | hdr | srgb);
|
||||||
|
|
||||||
|
|
|
@ -19744,8 +19744,8 @@ bool colormap( colormap_t *cm, const char *texture_name, bool load_as_srgb ) {
|
||||||
FREE(cm->texture), cm->texture = NULL;
|
FREE(cm->texture), cm->texture = NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
// int srgb = load_as_srgb ? TEXTURE_SRGB : 0;
|
int srgb = load_as_srgb ? TEXTURE_SRGB : 0;
|
||||||
int srgb = 0;
|
// int srgb = 0;
|
||||||
int hdr = strendi(texture_name, ".hdr") ? TEXTURE_FLOAT|TEXTURE_RGBA : 0;
|
int hdr = strendi(texture_name, ".hdr") ? TEXTURE_FLOAT|TEXTURE_RGBA : 0;
|
||||||
texture_t t = texture_compressed(texture_name, TEXTURE_LINEAR | TEXTURE_ANISOTROPY | TEXTURE_MIPMAPS | TEXTURE_REPEAT | hdr | srgb);
|
texture_t t = texture_compressed(texture_name, TEXTURE_LINEAR | TEXTURE_ANISOTROPY | TEXTURE_MIPMAPS | TEXTURE_REPEAT | hdr | srgb);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue