diff --git a/demos/06-material.c b/demos/06-material.c index 5283354..9f06faf 100644 --- a/demos/06-material.c +++ b/demos/06-material.c @@ -37,8 +37,8 @@ int main() { // load model model_t m1 = model("suzanne.obj", MODEL_NO_ANIMATIONS); model_t m2 = model("suzanne.obj", MODEL_NO_ANIMATIONS|MODEL_MATCAPS); - model_t m3 = model("damagedhelmet.gltf", MODEL_NO_ANIMATIONS|MODEL_PBR); - // model_t m3 = model("Scutum_low.fbx", MODEL_NO_ANIMATIONS|MODEL_PBR); + // model_t m3 = model("damagedhelmet.gltf", MODEL_NO_ANIMATIONS|MODEL_PBR); + model_t m3 = model("Scutum_low.fbx", MODEL_NO_ANIMATIONS|MODEL_PBR); // model_t m4 = model("avp/scene.gltf", MODEL_NO_ANIMATIONS|MODEL_PBR); // model_t m3 = model("Cerberus_LP.FBX", MODEL_NO_ANIMATIONS|MODEL_PBR); diff --git a/demos/art/fx/fxAces.fs b/demos/art/fx/fxAces.fs new file mode 100644 index 0000000..e43bd3c --- /dev/null +++ b/demos/art/fx/fxAces.fs @@ -0,0 +1,16 @@ +out vec4 color; + +void main(void) { + vec2 uv = TEXCOORD.st; + vec3 src = texture2D(iChannel0, uv).rgb; + vec3 x = src; + + // aces film (CC0, src: https://knarkowicz.wordpress.com/2016/01/06/aces-filmic-tone-mapping-curve/) + float a = 2.51f; + float b = 0.03f; + float c = 2.43f; + float d = 0.59f; + float e = 0.14f; + src = clamp((x*(a*x+b))/(x*(c*x+d)+e), 0.0, 1.0); + color = vec4(src, 1.0); +} diff --git a/engine/art/shaders/fs_32_4_model.glsl b/engine/art/shaders/fs_32_4_model.glsl index 4f3445c..234a407 100644 --- a/engine/art/shaders/fs_32_4_model.glsl +++ b/engine/art/shaders/fs_32_4_model.glsl @@ -140,7 +140,7 @@ uniform ColorMap map_emissive; uniform sampler2D map_emissive_tex; #define sample_colormap(ColorMap_, uv_) \ (ColorMap_.has_tex ? texture( ColorMap_##_tex, uv_ ) : ColorMap_.color) -uniform float skysphere_rotation=-90; +uniform float skysphere_rotation=0; uniform float skysphere_mip_count; uniform float exposure=1; uniform uint frame_count; @@ -703,7 +703,7 @@ void main(void) color = clamp((x*(a*x+b))/(x*(c*x+d)+e), 0.0, 1.0); // gamma correction #endif - color = pow( color, vec3(1. / 2.2) ); + // color = pow( color, vec3(1. / 2.2) ); // Technically this alpha may be too transparent, if there is a lot of reflected light we wouldn't // see the background, maybe we can approximate it well enough by adding a fresnel term diff --git a/engine/joint/v4k.h b/engine/joint/v4k.h index f1271d2..14f5413 100644 --- a/engine/joint/v4k.h +++ b/engine/joint/v4k.h @@ -372608,8 +372608,8 @@ bool colormap( colormap_t *cm, const char *texture_name, bool load_as_srgb ) { } int srgb = load_as_srgb ? TEXTURE_SRGB : 0; - int hdr = strendi(texture_name, ".hdr") ? TEXTURE_FLOAT : 0; - texture_t t = texture_compressed(texture_name, TEXTURE_RGBA | TEXTURE_LINEAR | TEXTURE_MIPMAPS | TEXTURE_REPEAT | hdr | srgb); + int hdr = strendi(texture_name, ".hdr") ? TEXTURE_FLOAT|TEXTURE_RGBA : 0; + texture_t t = texture_compressed(texture_name, TEXTURE_LINEAR | TEXTURE_MIPMAPS | TEXTURE_REPEAT | hdr | srgb); if( t.id == texture_checker().id ) { cm->texture = NULL; @@ -373279,7 +373279,7 @@ static char* strcpy_safe(char *d, const char *s) { static void model_load_pbr_layer(material_layer_t *layer, const char *texname, bool load_as_srgb) { strcpy_safe(layer->texname, texname); - colormap(&layer->map, texname, load_as_srgb); + colormap(&layer->map, texname, false); } static diff --git a/engine/split/v4k_render.c b/engine/split/v4k_render.c index 3c70ed7..82db3d1 100644 --- a/engine/split/v4k_render.c +++ b/engine/split/v4k_render.c @@ -2590,8 +2590,8 @@ bool colormap( colormap_t *cm, const char *texture_name, bool load_as_srgb ) { } int srgb = load_as_srgb ? TEXTURE_SRGB : 0; - int hdr = strendi(texture_name, ".hdr") ? TEXTURE_FLOAT : 0; - texture_t t = texture_compressed(texture_name, TEXTURE_RGBA | TEXTURE_LINEAR | TEXTURE_MIPMAPS | TEXTURE_REPEAT | hdr | srgb); + int hdr = strendi(texture_name, ".hdr") ? TEXTURE_FLOAT|TEXTURE_RGBA : 0; + texture_t t = texture_compressed(texture_name, TEXTURE_LINEAR | TEXTURE_MIPMAPS | TEXTURE_REPEAT | hdr | srgb); if( t.id == texture_checker().id ) { cm->texture = NULL; @@ -3261,7 +3261,7 @@ static char* strcpy_safe(char *d, const char *s) { static void model_load_pbr_layer(material_layer_t *layer, const char *texname, bool load_as_srgb) { strcpy_safe(layer->texname, texname); - colormap(&layer->map, texname, load_as_srgb); + colormap(&layer->map, texname, false); } static diff --git a/engine/v4k.c b/engine/v4k.c index cf9baa3..0ad3568 100644 --- a/engine/v4k.c +++ b/engine/v4k.c @@ -19762,8 +19762,8 @@ bool colormap( colormap_t *cm, const char *texture_name, bool load_as_srgb ) { } int srgb = load_as_srgb ? TEXTURE_SRGB : 0; - int hdr = strendi(texture_name, ".hdr") ? TEXTURE_FLOAT : 0; - texture_t t = texture_compressed(texture_name, TEXTURE_RGBA | TEXTURE_LINEAR | TEXTURE_MIPMAPS | TEXTURE_REPEAT | hdr | srgb); + int hdr = strendi(texture_name, ".hdr") ? TEXTURE_FLOAT|TEXTURE_RGBA : 0; + texture_t t = texture_compressed(texture_name, TEXTURE_LINEAR | TEXTURE_MIPMAPS | TEXTURE_REPEAT | hdr | srgb); if( t.id == texture_checker().id ) { cm->texture = NULL; @@ -20433,7 +20433,7 @@ static char* strcpy_safe(char *d, const char *s) { static void model_load_pbr_layer(material_layer_t *layer, const char *texname, bool load_as_srgb) { strcpy_safe(layer->texname, texname); - colormap(&layer->map, texname, load_as_srgb); + colormap(&layer->map, texname, false); } static