diff --git a/engine/art/shaders/fs_24_4_sprite.glsl b/engine/art/shaders/fs_24_4_sprite.glsl index 7050495..6a99df2 100644 --- a/engine/art/shaders/fs_24_4_sprite.glsl +++ b/engine/art/shaders/fs_24_4_sprite.glsl @@ -1,5 +1,5 @@ uniform sampler2D u_texture; - +uniform float gamma; /// set:2.2 in vec2 vTexCoord; in vec4 vColor; @@ -54,4 +54,5 @@ void main() { vec4 texColor = texture_AA2(u_texture, vTexCoord); if(texColor.a < 0.9) discard; fragColor = vColor * texColor; + fragColor.rgb = pow(fragColor.rgb, vec3(gamma)); } \ No newline at end of file diff --git a/engine/art/shaders/fs_32_4_model.glsl b/engine/art/shaders/fs_32_4_model.glsl index 4ca85c4..2133565 100644 --- a/engine/art/shaders/fs_32_4_model.glsl +++ b/engine/art/shaders/fs_32_4_model.glsl @@ -17,7 +17,7 @@ in vec3 v_position; in vec3 v_position_ws; #ifdef RIM uniform mat4 M; // RIM -uniform vec3 u_rimcolor = vec3(0.2,0.2,0.2); +uniform vec3 u_rimcolor = vec3(0.05,0.05,0.05); uniform vec3 u_rimrange = vec3(0.11,0.98,0.5); uniform vec3 u_rimpivot = vec3(0,0,0); uniform bool u_rimambient = true; @@ -445,7 +445,8 @@ void main() { } float rim = 1.0 - max(dot(v,n), 0.0); vec3 col = u_rimcolor*(pow(smoothstep(1.0-u_rimrange.x,u_rimrange.y,rim), u_rimrange.z)); - fragcolor += vec4(col, 1.0);} + fragcolor += vec4(col, 0.0); + } #endif } #endif @@ -719,7 +720,8 @@ void main(void) } float rim = 1.0 - max(dot(v,n), 0.0); vec3 col = u_rimcolor*(pow(smoothstep(1.0-u_rimrange.x,u_rimrange.y,rim), u_rimrange.z)); - fragcolor += vec4(col, 1.0);} + fragcolor += vec4(col, 0.0); + } #endif } diff --git a/engine/joint/v4k.h b/engine/joint/v4k.h index de958ce..8b90f05 100644 --- a/engine/joint/v4k.h +++ b/engine/joint/v4k.h @@ -372374,10 +372374,11 @@ int ui_postfx(postfx *fx, int pass) { } static __thread array(handle) last_fb; +static postfx gamma_fx; bool postfx_begin(postfx *fx, int width, int height) { // reset clear color: needed in case transparent window is being used (alpha != 0) - glClearColor(0,0,0,0); // @transparent + if (fx != &gamma_fx) glClearColor(0,0,0,0); // @transparent width += !width; height += !height; @@ -372504,7 +372505,7 @@ bool postfx_end(postfx *fx) { return true; } -static postfx fx, gamma_fx; +static postfx fx; int fx_load_from_mem(const char *nameid, const char *content) { do_once postfx_create(&fx, 0); return postfx_load_from_mem(&fx, nameid, content); diff --git a/engine/split/v4k_render.c b/engine/split/v4k_render.c index 8d9a113..9fa5aa0 100644 --- a/engine/split/v4k_render.c +++ b/engine/split/v4k_render.c @@ -2354,10 +2354,11 @@ int ui_postfx(postfx *fx, int pass) { } static __thread array(handle) last_fb; +static postfx gamma_fx; bool postfx_begin(postfx *fx, int width, int height) { // reset clear color: needed in case transparent window is being used (alpha != 0) - glClearColor(0,0,0,0); // @transparent + if (fx != &gamma_fx) glClearColor(0,0,0,0); // @transparent width += !width; height += !height; @@ -2484,7 +2485,7 @@ bool postfx_end(postfx *fx) { return true; } -static postfx fx, gamma_fx; +static postfx fx; int fx_load_from_mem(const char *nameid, const char *content) { do_once postfx_create(&fx, 0); return postfx_load_from_mem(&fx, nameid, content); diff --git a/engine/v4k.c b/engine/v4k.c index cc7a08b..df6deb7 100644 --- a/engine/v4k.c +++ b/engine/v4k.c @@ -19529,10 +19529,11 @@ int ui_postfx(postfx *fx, int pass) { } static __thread array(handle) last_fb; +static postfx gamma_fx; bool postfx_begin(postfx *fx, int width, int height) { // reset clear color: needed in case transparent window is being used (alpha != 0) - glClearColor(0,0,0,0); // @transparent + if (fx != &gamma_fx) glClearColor(0,0,0,0); // @transparent width += !width; height += !height; @@ -19659,7 +19660,7 @@ bool postfx_end(postfx *fx) { return true; } -static postfx fx, gamma_fx; +static postfx fx; int fx_load_from_mem(const char *nameid, const char *content) { do_once postfx_create(&fx, 0); return postfx_load_from_mem(&fx, nameid, content);