improve pbr shader, introduce fxAces.fs
parent
a54a6392f3
commit
2bc338172c
|
@ -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);
|
||||
|
||||
|
|
|
@ -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);
|
||||
}
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue