Brighter ambiance, darker LOD shadows.

This commit is contained in:
Joshua Yanovski 2020-04-27 14:01:43 +02:00
parent e0452e895c
commit 48c93d2b41
8 changed files with 9 additions and 6 deletions

View File

@ -80,7 +80,7 @@ void main() {
float max_light = 0.0; float max_light = 0.0;
max_light += get_sun_diffuse2(f_norm, sun_dir, moon_dir, view_dir, k_a/* * (shade_frac * 0.5 + light_frac * 0.5)*/, k_d, k_s, alpha, emitted_light, reflected_light); max_light += get_sun_diffuse2(f_norm, sun_dir, moon_dir, view_dir, k_a/* * (shade_frac * 0.5 + light_frac * 0.5)*/, k_d, k_s, alpha, emitted_light, reflected_light);
reflected_light *= point_shadow * shade_frac; reflected_light *= point_shadow * shade_frac;
emitted_light *= point_shadow; emitted_light *= point_shadow * max(shade_frac, MIN_SHADOW);
max_light *= point_shadow * shade_frac; max_light *= point_shadow * shade_frac;
max_light += lights_at(f_pos, f_norm, view_dir, k_a, k_d, k_s, alpha, emitted_light, reflected_light); max_light += lights_at(f_pos, f_norm, view_dir, k_a, k_d, k_s, alpha, emitted_light, reflected_light);

View File

@ -79,7 +79,7 @@ void main() {
float max_light = 0.0; float max_light = 0.0;
max_light += get_sun_diffuse2(f_norm, /*time_of_day.x*/sun_dir, moon_dir, /*-cam_to_frag*/view_dir, k_a/* * (shade_frac * 0.5 + light_frac * 0.5)*/, vec3(0.0), k_s, alpha, emitted_light, reflected_light); max_light += get_sun_diffuse2(f_norm, /*time_of_day.x*/sun_dir, moon_dir, /*-cam_to_frag*/view_dir, k_a/* * (shade_frac * 0.5 + light_frac * 0.5)*/, vec3(0.0), k_s, alpha, emitted_light, reflected_light);
reflected_light *= f_light * point_shadow * shade_frac; reflected_light *= f_light * point_shadow * shade_frac;
emitted_light *= f_light * point_shadow; emitted_light *= f_light * point_shadow * max(shade_frac, MIN_SHADOW);
max_light *= f_light * point_shadow * shade_frac; max_light *= f_light * point_shadow * shade_frac;
// get_sun_diffuse(f_norm, time_of_day.x, light, diffuse_light, ambient_light, 0.0); // get_sun_diffuse(f_norm, time_of_day.x, light, diffuse_light, ambient_light, 0.0);
// diffuse_light *= f_light * point_shadow; // diffuse_light *= f_light * point_shadow;

View File

@ -144,7 +144,7 @@ void main() {
float max_light = 0.0; float max_light = 0.0;
max_light += get_sun_diffuse2(norm, /*time_of_day.x*/sun_dir, moon_dir, view_dir, k_a/* * (shade_frac * 0.5 + light_frac * 0.5)*/, vec3(0.0), /*vec3(f_light * point_shadow)*//*reflect_color*/k_s, alpha, emitted_light, reflected_light); max_light += get_sun_diffuse2(norm, /*time_of_day.x*/sun_dir, moon_dir, view_dir, k_a/* * (shade_frac * 0.5 + light_frac * 0.5)*/, vec3(0.0), /*vec3(f_light * point_shadow)*//*reflect_color*/k_s, alpha, emitted_light, reflected_light);
reflected_light *= reflect_color * f_light * point_shadow * shade_frac; reflected_light *= reflect_color * f_light * point_shadow * shade_frac;
emitted_light *= f_light * point_shadow; emitted_light *= f_light * point_shadow * max(shade_frac, MIN_SHADOW);
max_light *= f_light * point_shadow * shade_frac; max_light *= f_light * point_shadow * shade_frac;
vec3 diffuse_light_point = vec3(0.0); vec3 diffuse_light_point = vec3(0.0);

View File

@ -5,6 +5,8 @@
uniform sampler2D t_map; uniform sampler2D t_map;
uniform sampler2D t_horizon; uniform sampler2D t_horizon;
const float MIN_SHADOW = 0.33;
vec2 pos_to_uv(sampler2D sampler, vec2 pos) { vec2 pos_to_uv(sampler2D sampler, vec2 pos) {
// Want: (pixel + 0.5) / W // Want: (pixel + 0.5) / W
vec2 texSize = textureSize(sampler, 0); vec2 texSize = textureSize(sampler, 0);

View File

@ -123,7 +123,7 @@ vec3 get_moon_color(vec3 moon_dir) {
// Returns computed maximum intensity. // Returns computed maximum intensity.
float get_sun_diffuse2(vec3 norm, vec3 sun_dir, vec3 moon_dir, vec3 dir, vec3 k_a, vec3 k_d, vec3 k_s, float alpha, out vec3 emitted_light, out vec3 reflected_light) { float get_sun_diffuse2(vec3 norm, vec3 sun_dir, vec3 moon_dir, vec3 dir, vec3 k_a, vec3 k_d, vec3 k_s, float alpha, out vec3 emitted_light, out vec3 reflected_light) {
const float SUN_AMBIANCE = 0.23 / 3.0;/* / 1.8*/;// 0.1 / 3.0; const float SUN_AMBIANCE = 0.23;/* / 1.8*/;// 0.1 / 3.0;
const float SUN_COLOR_FACTOR = 6.0;//1.8; const float SUN_COLOR_FACTOR = 6.0;//1.8;
const float MOON_AMBIANCE = 0.23;//0.1; const float MOON_AMBIANCE = 0.23;//0.1;

View File

@ -152,6 +152,7 @@ void main() {
float max_light = 0.0; float max_light = 0.0;
max_light += get_sun_diffuse2(f_norm/*l_norm*/, sun_dir, moon_dir, view_dir, vec3(1.0)/* * (0.5 * light_frac + vec3(0.5 * shade_frac))*/, vec3(1.0), /*0.5 * shade_frac * *//*vec3(1.0)*//*f_col*/vec3(R_s), alpha, emitted_light, reflected_light); max_light += get_sun_diffuse2(f_norm/*l_norm*/, sun_dir, moon_dir, view_dir, vec3(1.0)/* * (0.5 * light_frac + vec3(0.5 * shade_frac))*/, vec3(1.0), /*0.5 * shade_frac * *//*vec3(1.0)*//*f_col*/vec3(R_s), alpha, emitted_light, reflected_light);
// emitted_light = vec3(1.0); // emitted_light = vec3(1.0);
emitted_light *= max(shade_frac, MIN_SHADOW);
reflected_light *= shade_frac; reflected_light *= shade_frac;
max_light *= shade_frac; max_light *= shade_frac;
// reflected_light = vec3(0.0); // reflected_light = vec3(0.0);

View File

@ -73,7 +73,7 @@ void main() {
float max_light = 0.0; float max_light = 0.0;
max_light += get_sun_diffuse2(f_norm, /*time_of_day.x, */sun_dir, moon_dir, /*cam_to_frag*/view_dir, k_a/* * (shade_frac * 0.5 + light_frac * 0.5)*/, k_d, k_s, alpha, emitted_light, reflected_light); max_light += get_sun_diffuse2(f_norm, /*time_of_day.x, */sun_dir, moon_dir, /*cam_to_frag*/view_dir, k_a/* * (shade_frac * 0.5 + light_frac * 0.5)*/, k_d, k_s, alpha, emitted_light, reflected_light);
reflected_light *= vert_light * point_shadow * shade_frac; reflected_light *= vert_light * point_shadow * shade_frac;
emitted_light *= vert_light * point_shadow; emitted_light *= vert_light * point_shadow * max(shade_frac, MIN_SHADOW);
max_light *= vert_light * point_shadow * shade_frac; max_light *= vert_light * point_shadow * shade_frac;
// get_sun_diffuse(f_norm, time_of_day.x, light, diffuse_light, ambient_light, 1.0); // get_sun_diffuse(f_norm, time_of_day.x, light, diffuse_light, ambient_light, 1.0);
// float point_shadow = shadow_at(f_pos, f_norm); // float point_shadow = shadow_at(f_pos, f_norm);

View File

@ -73,7 +73,7 @@ void main() {
float point_shadow = shadow_at(f_pos, f_norm); float point_shadow = shadow_at(f_pos, f_norm);
max_light += get_sun_diffuse2(f_norm, /*time_of_day.x, */sun_dir, moon_dir, view_dir, k_a/* * (shade_frac * 0.5 + light_frac * 0.5)*/, k_d, k_s, alpha, emitted_light, reflected_light); max_light += get_sun_diffuse2(f_norm, /*time_of_day.x, */sun_dir, moon_dir, view_dir, k_a/* * (shade_frac * 0.5 + light_frac * 0.5)*/, k_d, k_s, alpha, emitted_light, reflected_light);
emitted_light *= f_light * point_shadow; emitted_light *= f_light * point_shadow * max(shade_frac, MIN_SHADOW);
reflected_light *= f_light * point_shadow * shade_frac; reflected_light *= f_light * point_shadow * shade_frac;
max_light *= f_light * point_shadow * shade_frac; max_light *= f_light * point_shadow * shade_frac;