pbr load as srgb + gamma correction tweaks

main
Dominik Madarász 2024-08-24 20:09:41 +02:00
parent 9ed0c978a3
commit cde29d5a5a
4 changed files with 10 additions and 7 deletions

View File

@ -209,9 +209,12 @@ surface_t surface() {
float c = 2.43f;
float d = 0.59f;
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
s.fragcolor.rgb = pow( color, vec3(1.0/2.2) );
// s.fragcolor.rgb = pow(s.fragcolor.rgb, vec3(1.0/2.2) );
}
#endif

View File

@ -384602,8 +384602,8 @@ bool colormap( colormap_t *cm, const char *texture_name, bool load_as_srgb ) {
FREE(cm->texture), cm->texture = NULL;
}
// int srgb = load_as_srgb ? TEXTURE_SRGB : 0;
int srgb = 0;
int srgb = load_as_srgb ? TEXTURE_SRGB : 0;
// int srgb = 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);

View File

@ -2945,8 +2945,8 @@ bool colormap( colormap_t *cm, const char *texture_name, bool load_as_srgb ) {
FREE(cm->texture), cm->texture = NULL;
}
// int srgb = load_as_srgb ? TEXTURE_SRGB : 0;
int srgb = 0;
int srgb = load_as_srgb ? TEXTURE_SRGB : 0;
// int srgb = 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);

View File

@ -19744,8 +19744,8 @@ bool colormap( colormap_t *cm, const char *texture_name, bool load_as_srgb ) {
FREE(cm->texture), cm->texture = NULL;
}
// int srgb = load_as_srgb ? TEXTURE_SRGB : 0;
int srgb = 0;
int srgb = load_as_srgb ? TEXTURE_SRGB : 0;
// int srgb = 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);