mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Sun, brightness, and gamma adjustments
This commit is contained in:
parent
bcc220804a
commit
0f2e7434fc
@ -291,7 +291,7 @@ void main() {
|
|||||||
// diffuse_light += point_light;
|
// diffuse_light += point_light;
|
||||||
// reflected_light += point_light;
|
// reflected_light += point_light;
|
||||||
// vec3 surf_color = srgb_to_linear(vec3(0.2, 0.5, 1.0)) * light * diffuse_light * ambient_light;
|
// vec3 surf_color = srgb_to_linear(vec3(0.2, 0.5, 1.0)) * light * diffuse_light * ambient_light;
|
||||||
const float REFLECTANCE = 0.25;
|
const float REFLECTANCE = 0.5;
|
||||||
vec3 surf_color = illuminate(max_light, view_dir, water_color * emitted_light/* * log(1.0 - MU_WATER)*/, /*cam_attenuation * *//*water_color * */reflect_color * REFLECTANCE/** reflected_light*//* * log(1.0 - MU_WATER)*/);
|
vec3 surf_color = illuminate(max_light, view_dir, water_color * emitted_light/* * log(1.0 - MU_WATER)*/, /*cam_attenuation * *//*water_color * */reflect_color * REFLECTANCE/** reflected_light*//* * log(1.0 - MU_WATER)*/);
|
||||||
|
|
||||||
// passthrough = pow(passthrough, 1.0 / (1.0 + water_depth_to_camera));
|
// passthrough = pow(passthrough, 1.0 / (1.0 + water_depth_to_camera));
|
||||||
|
@ -16,13 +16,13 @@ const float PI = 3.141592;
|
|||||||
const vec3 SKY_DAY_TOP = vec3(0.1, 0.5, 0.9);
|
const vec3 SKY_DAY_TOP = vec3(0.1, 0.5, 0.9);
|
||||||
const vec3 SKY_DAY_MID = vec3(0.02, 0.28, 0.8);
|
const vec3 SKY_DAY_MID = vec3(0.02, 0.28, 0.8);
|
||||||
const vec3 SKY_DAY_BOT = vec3(0.1, 0.2, 0.3);
|
const vec3 SKY_DAY_BOT = vec3(0.1, 0.2, 0.3);
|
||||||
const vec3 DAY_LIGHT = vec3(1.9, 1.75, 0.9);//vec3(1.5, 1.4, 1.0);
|
const vec3 DAY_LIGHT = vec3(2.8, 3.5, 1.8);
|
||||||
const vec3 SUN_HALO_DAY = vec3(0.35, 0.35, 0.05);
|
const vec3 SUN_HALO_DAY = vec3(0.06, 0.06, 0.005);
|
||||||
|
|
||||||
const vec3 SKY_DUSK_TOP = vec3(0.06, 0.1, 0.20);
|
const vec3 SKY_DUSK_TOP = vec3(0.06, 0.1, 0.20);
|
||||||
const vec3 SKY_DUSK_MID = vec3(0.35, 0.1, 0.15);
|
const vec3 SKY_DUSK_MID = vec3(0.35, 0.1, 0.15);
|
||||||
const vec3 SKY_DUSK_BOT = vec3(0.0, 0.1, 0.23);
|
const vec3 SKY_DUSK_BOT = vec3(0.0, 0.1, 0.23);
|
||||||
const vec3 DUSK_LIGHT = vec3(5.0, 0.5, 0.15);
|
const vec3 DUSK_LIGHT = vec3(8.0, 1.5, 0.15);
|
||||||
const vec3 SUN_HALO_DUSK = vec3(1.2, 0.15, 0.01);
|
const vec3 SUN_HALO_DUSK = vec3(1.2, 0.15, 0.01);
|
||||||
|
|
||||||
const vec3 SKY_NIGHT_TOP = vec3(0.001, 0.001, 0.0025);
|
const vec3 SKY_NIGHT_TOP = vec3(0.001, 0.001, 0.0025);
|
||||||
@ -96,7 +96,7 @@ float cloud_shadow(vec3 pos, vec3 light_dir) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float get_sun_brightness(/*vec3 sun_dir*/) {
|
float get_sun_brightness(/*vec3 sun_dir*/) {
|
||||||
return max(-sun_dir.z + 0.7, 0.0) * 0.9;
|
return max(-sun_dir.z + 0.5, 0.0) * 0.9;
|
||||||
}
|
}
|
||||||
|
|
||||||
float get_moon_brightness(/*vec3 moon_dir*/) {
|
float get_moon_brightness(/*vec3 moon_dir*/) {
|
||||||
@ -420,7 +420,7 @@ vec3 get_sky_color(vec3 dir, float time_of_day, vec3 origin, vec3 f_pos, float q
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Sun
|
// Sun
|
||||||
const vec3 SUN_SURF_COLOR = vec3(1.5, 0.9, 0.35) * 30.0;
|
const vec3 SUN_SURF_COLOR = vec3(1.5, 0.9, 0.35) * 3.0;
|
||||||
|
|
||||||
vec3 sun_halo_color = mix(
|
vec3 sun_halo_color = mix(
|
||||||
SUN_HALO_DUSK,
|
SUN_HALO_DUSK,
|
||||||
@ -431,21 +431,21 @@ vec3 get_sky_color(vec3 dir, float time_of_day, vec3 origin, vec3 f_pos, float q
|
|||||||
vec3 sun_halo = sun_halo_color * 16 * pow(max(dot(dir, -sun_dir), 0), 8.0);
|
vec3 sun_halo = sun_halo_color * 16 * pow(max(dot(dir, -sun_dir), 0), 8.0);
|
||||||
vec3 sun_surf = vec3(0);
|
vec3 sun_surf = vec3(0);
|
||||||
if (with_features) {
|
if (with_features) {
|
||||||
float angle = 0.0005;
|
float angle = 0.00035;
|
||||||
sun_surf = clamp((dot(dir, -sun_dir) - (1.0 - angle)) / angle, 0, 1) * SUN_SURF_COLOR * SUN_COLOR_FACTOR;
|
sun_surf = clamp((dot(dir, -sun_dir) - (1.0 - angle)) * 4 / angle, 0, 1) * SUN_SURF_COLOR * SUN_COLOR_FACTOR;
|
||||||
}
|
}
|
||||||
vec3 sun_light = sun_halo + sun_surf;
|
vec3 sun_light = sun_halo + sun_surf;
|
||||||
|
|
||||||
// Moon
|
// Moon
|
||||||
const vec3 MOON_SURF_COLOR = vec3(0.7, 1.0, 1.5) * 30.0;
|
const vec3 MOON_SURF_COLOR = vec3(0.7, 1.0, 1.5) * 3.0;
|
||||||
const vec3 MOON_HALO_COLOR = vec3(0.015, 0.015, 0.05) * 10;
|
const vec3 MOON_HALO_COLOR = vec3(0.015, 0.015, 0.05) * 25;
|
||||||
|
|
||||||
vec3 moon_halo_color = MOON_HALO_COLOR;
|
vec3 moon_halo_color = MOON_HALO_COLOR;
|
||||||
vec3 moon_halo = moon_halo_color * pow(max(dot(dir, -moon_dir), 0), 50.0);
|
vec3 moon_halo = moon_halo_color * pow(max(dot(dir, -moon_dir), 0), 500.0);
|
||||||
vec3 moon_surf = vec3(0);
|
vec3 moon_surf = vec3(0);
|
||||||
if (with_features) {
|
if (with_features) {
|
||||||
float angle = 0.0005;
|
float angle = 0.00035;
|
||||||
moon_surf = clamp((dot(dir, -moon_dir) - (1.0 - angle)) / angle, 0, 1) * MOON_SURF_COLOR;
|
moon_surf = clamp((dot(dir, -moon_dir) - (1.0 - angle)) * 4 / angle, 0, 1) * MOON_SURF_COLOR;
|
||||||
}
|
}
|
||||||
vec3 moon_light = moon_halo + moon_surf;
|
vec3 moon_light = moon_halo + moon_surf;
|
||||||
|
|
||||||
|
@ -36,8 +36,8 @@ out float pull_down;
|
|||||||
// out float f_light;
|
// out float f_light;
|
||||||
|
|
||||||
void main() {
|
void main() {
|
||||||
// Find distances between vertices.
|
// Find distances between vertices. Pull down a tiny bit more to reduce z fighting near the ocean.
|
||||||
f_pos = lod_pos(v_pos, focus_pos.xy);
|
f_pos = lod_pos(v_pos, focus_pos.xy) - vec3(0, 0, 0.1);
|
||||||
vec2 dims = vec2(1.0 / view_distance.y);
|
vec2 dims = vec2(1.0 / view_distance.y);
|
||||||
vec4 f_square = focus_pos.xyxy + vec4(splay(v_pos - dims), splay(v_pos + dims));
|
vec4 f_square = focus_pos.xyxy + vec4(splay(v_pos - dims), splay(v_pos + dims));
|
||||||
f_norm = lod_norm(f_pos.xy, f_square);
|
f_norm = lod_norm(f_pos.xy, f_square);
|
||||||
|
@ -205,9 +205,9 @@ void main() {
|
|||||||
vec4 aa_color = aa_apply(src_color, uv * screen_res.xy, screen_res.xy);
|
vec4 aa_color = aa_apply(src_color, uv * screen_res.xy, screen_res.xy);
|
||||||
|
|
||||||
// Tonemapping
|
// Tonemapping
|
||||||
float exposure_offset = 1.5;
|
float exposure_offset = 1.0;
|
||||||
// Adding an in-code offset to gamma and explosure let us have more precise control over the game's look
|
// Adding an in-code offset to gamma and explosure let us have more precise control over the game's look
|
||||||
float gamma_offset = 0.35;
|
float gamma_offset = 0.3;
|
||||||
aa_color.rgb = vec3(1.0) - exp(-aa_color.rgb * (gamma_exposure.y + exposure_offset));
|
aa_color.rgb = vec3(1.0) - exp(-aa_color.rgb * (gamma_exposure.y + exposure_offset));
|
||||||
// gamma correction
|
// gamma correction
|
||||||
aa_color.rgb = pow(aa_color.rgb, vec3(gamma_exposure.x + gamma_offset));
|
aa_color.rgb = pow(aa_color.rgb, vec3(gamma_exposure.x + gamma_offset));
|
||||||
|
Loading…
Reference in New Issue
Block a user