diff --git a/assets/voxygen/shaders/include/cloud/regular.glsl b/assets/voxygen/shaders/include/cloud/regular.glsl index 014b8b2771..1e5542e374 100644 --- a/assets/voxygen/shaders/include/cloud/regular.glsl +++ b/assets/voxygen/shaders/include/cloud/regular.glsl @@ -61,8 +61,8 @@ vec4 cloud_at(vec3 pos, float dist, vec3 dir, out vec3 emission, out float not_u ; } - float CLOUD_DEPTH = (view_distance.w - view_distance.z) * (0.2 + sqrt(cloud_tendency) * 0.5); - float cloud_alt = alt + CLOUD_DEPTH * 2 + 1000.0; + float CLOUD_DEPTH = (view_distance.w - view_distance.z) * (0.14 + sqrt(cloud_tendency) * 0.35); + float cloud_alt = alt + CLOUD_DEPTH * 2 + 1500.0; //vec2 cloud_attr = get_cloud_heights(wind_pos.xy); float sun_access = 0.0; @@ -181,14 +181,14 @@ vec4 cloud_at(vec3 pos, float dist, vec3 dir, out vec3 emission, out float not_u const uint QUALITY = 2u; #endif -const float STEP_SCALE = DIST_CAP / (10.0 * float(QUALITY)); +const float STEP_SCALE = DIST_CAP / (1000.0 * float(QUALITY)); float step_to_dist(float step, float quality) { - return pow(step, 2) * STEP_SCALE / quality; + return pow(step, 4) * STEP_SCALE / quality; } float dist_to_step(float dist, float quality) { - return pow(dist / STEP_SCALE * quality, 0.5); + return pow(dist / STEP_SCALE * quality, 0.25); } // This *MUST* go here: when clouds are enabled, it relies on the declaration of `clouds_at` above. Sadly, GLSL doesn't diff --git a/assets/voxygen/shaders/include/sky.glsl b/assets/voxygen/shaders/include/sky.glsl index 9a65198a76..b3348c1dbd 100644 --- a/assets/voxygen/shaders/include/sky.glsl +++ b/assets/voxygen/shaders/include/sky.glsl @@ -316,11 +316,11 @@ vec3 lightning_at(vec3 wpos) { // cam_attenuation is the total light attenuation due to the substance for beams between the point and the camera. // surface_alt is the altitude of the attenuating surface. float get_sun_diffuse2(DirectionalLight sun_info, DirectionalLight moon_info, vec3 norm, vec3 dir, vec3 wpos, vec3 mu, vec3 cam_attenuation, float surface_alt, vec3 k_a, vec3 k_d, vec3 k_s, float alpha, vec3 voxel_norm, float voxel_lighting, out vec3 emitted_light, out vec3 reflected_light) { - const vec3 SUN_AMBIANCE = MU_SCATTER;//0.23;/* / 1.8*/;// 0.1 / 3.0; + const vec3 SUN_AMBIANCE = MU_SCATTER; #ifdef EXPERIMENTAL_PHOTOREALISTIC const vec3 MOON_AMBIANCE = MU_SCATTER; #else - // Boost moon ambiance, because we don't properly compensate for pupil dilation (which should occur *before* HDR, + // Boost ambiance, because we don't properly compensate for pupil dilation (which should occur *before* HDR, // not in the end user's eye). Also, real nights are too dark to be fun. const vec3 MOON_AMBIANCE = vec3(0.15, 0.25, 0.23) * 5; #endif @@ -440,7 +440,14 @@ float get_sun_diffuse2(DirectionalLight sun_info, DirectionalLight moon_info, ve vec3 R_t_r = R_d + R_r; // vec3 half_vec = normalize(-norm + dir); - vec3 light_frac = R_t_b * (sun_chroma * SUN_AMBIANCE + moon_chroma * MOON_AMBIANCE) * light_reflection_factor(norm, /*norm*//*dir*/dir, /*-norm*/-/*dir*/norm, /*k_d*/k_d/* * (1.0 - k_s)*/, /*k_s*/vec3(0.0), alpha, voxel_norm, voxel_lighting); + #ifdef EXPERIMENTAL_PHOTOREALISTIC + vec3 lrf = light_reflection_factor(norm, dir, -norm, k_d, vec3(0.0), alpha, voxel_norm, voxel_lighting); + #else + // In practice, for gameplay purposes, we often want extra light at earlier and later times, so we use a + // non-physical LRF to boost light during dawn and dusk. + float lrf = pow(dot(norm, vec3(0, 0, 1)) + 1, 2) * 0.25; + #endif + vec3 light_frac = R_t_b * (sun_chroma * SUN_AMBIANCE + moon_chroma * MOON_AMBIANCE) * lrf; // vec3 light_frac = /*vec3(1.0)*//*H_d * */ // SUN_AMBIANCE * /*sun_light*/sun_chroma * light_reflection_factor(norm, dir, /*vec3(0, 0, -1.0)*/-norm, vec3((1.0 + cos_sun) * 0.5), vec3(k_s * (1.0 - cos_sun) * 0.5), alpha) + // MOON_AMBIANCE * /*sun_light*/moon_chroma * light_reflection_factor(norm, dir, /*vec3(0, 0, -1.0)*/-norm, vec3((1.0 + cos_moon) * 0.5), vec3(k_s * (1.0 - cos_moon) * 0.5), alpha); diff --git a/assets/voxygen/shaders/lod-object-frag.glsl b/assets/voxygen/shaders/lod-object-frag.glsl index 3e0317385d..3e8bf9c714 100644 --- a/assets/voxygen/shaders/lod-object-frag.glsl +++ b/assets/voxygen/shaders/lod-object-frag.glsl @@ -87,12 +87,12 @@ void main() { float my_alt = f_pos.z + focus_off.z; float f_ao = 1.0; const float VOXELIZE_DIST = 2000; - float voxelize_factor = clamp(1.0 - (distance(focus_pos.xy, f_pos.xy) - view_distance.x) * (1.0 / VOXELIZE_DIST), 0, 1.0); + float voxelize_factor = clamp(1.0 - (distance(cam_pos.xy, f_pos.xy) - view_distance.x) * (1.0 / VOXELIZE_DIST), 0, 1.0); vec3 cam_dir = cam_to_frag; #ifdef EXPERIMENTAL_NOLODVOXELS - vec3 side_norm = normalize(vec3(f_norm.xy, 0)); - vec3 top_norm = vec3(0, 0, 1); - voxel_norm = normalize(mix(side_norm, top_norm, cam_dir.z)); + //vec3 side_norm = normalize(vec3(f_norm.xy, 0)); + //vec3 top_norm = vec3(0, 0, 1); + voxel_norm = f_norm;//normalize(mix(side_norm, top_norm, cam_dir.z)); #else float base_surf_depth = lod_voxel_noise(f_pos); float t = -1.5 + base_surf_depth; diff --git a/assets/voxygen/shaders/lod-terrain-frag.glsl b/assets/voxygen/shaders/lod-terrain-frag.glsl index b9937f0606..05759c7974 100644 --- a/assets/voxygen/shaders/lod-terrain-frag.glsl +++ b/assets/voxygen/shaders/lod-terrain-frag.glsl @@ -60,19 +60,19 @@ void main() { vec4(f_pos, 1); gl_Position.z = -1000.0 / (gl_Position.z + 10000.0); */ vec3 my_pos = vec3(f_pos.xy, my_alt); - vec3 my_norm = lod_norm(f_pos.xy/*, f_square*/); + //vec3 my_norm = lod_norm(f_pos.xy/*, f_square*/); - float which_norm = dot(my_norm, normalize(cam_pos.xyz - my_pos)); + //float which_norm = dot(my_norm, normalize(cam_pos.xyz - my_pos)); // which_norm = 0.5 + which_norm * 0.5; // which_norm = pow(max(0.0, which_norm), /*0.03125*/1 / 8.0);// * 0.5; // smoothstep - which_norm = which_norm * which_norm * (3 - 2 * abs(which_norm)); + //which_norm = which_norm * which_norm * (3 - 2 * abs(which_norm)); // which_norm = mix(0.0, 1.0, which_norm > 0.0); // vec3 normals[6] = vec3[](vec3(-1,0,0), vec3(1,0,0), vec3(0,-1,0), vec3(0,1,0), vec3(0,0,-1), vec3(0,0,1)); - vec3 f_norm = mix(faceforward(f_norm, cam_pos.xyz - f_pos, -f_norm), my_norm, which_norm); - vec3 f_pos = mix(f_pos, my_pos, which_norm); + vec3 f_norm = lod_norm(f_pos.xy);//mix(faceforward(f_norm, cam_pos.xyz - f_pos, -f_norm), my_norm, which_norm); + vec3 f_pos = mix(f_pos, my_pos, f_norm); // vec3 fract_pos = fract(f_pos); /* if (length(f_pos - cam_pos.xyz) <= view_distance.x + 32.0) { vec4 new_f_pos; @@ -122,12 +122,12 @@ void main() { float f_ao = 1.0; vec3 voxel_norm = f_norm; const float VOXELIZE_DIST = 2000; - float voxelize_factor = clamp(1.0 - (distance(focus_pos.xy, f_pos.xy) - view_distance.x) * (1.0 / VOXELIZE_DIST), 0, 1); + float voxelize_factor = clamp(1.0 - (distance(cam_pos.xy, f_pos.xy) - view_distance.x) * (1.0 / VOXELIZE_DIST), 0, 1); vec3 cam_dir = cam_to_frag; #ifdef EXPERIMENTAL_NOLODVOXELS - vec3 side_norm = normalize(vec3(my_norm.xy, 0.01)); - vec3 top_norm = vec3(0, 0, 1); - voxel_norm = normalize(mix(side_norm, top_norm, max(cam_dir.z, 0.0))); + //vec3 side_norm = normalize(vec3(my_norm.xy, 0.01)); + //vec3 top_norm = vec3(0, 0, 1); + voxel_norm = f_norm;//normalize(mix(side_norm, top_norm, max(cam_dir.z, 0.0))); #else #ifdef EXPERIMENTAL_PROCEDURALLODDETAIL float nz_offset = floor((noise_2d((floor(f_pos.xy) + focus_off.xy) * 0.01) - 0.5) * 3.0 / max(f_norm.z, 0.01)); @@ -373,10 +373,10 @@ void main() { vec3 reflect_color; #if (FLUID_MODE == FLUID_MODE_HIGH) - reflect_color = get_sky_color(reflect_ray, f_pos, vec3(-100000), 0.125, true, 1.0, true, sun_shade_frac); + reflect_color = get_sky_color(reflect_ray, f_pos, vec3(-100000), 0.125, false, 1.0, true, sun_shade_frac); reflect_color = get_cloud_color(reflect_color, reflect_ray, cam_pos.xyz, 100000.0, 0.1); #else - reflect_color = get_sky_color(reflect_ray, f_pos, vec3(-100000), 0.125, true, 1.0, true, sun_shade_frac); + reflect_color = get_sky_color(reflect_ray, f_pos, vec3(-100000), 0.125, false, 1.0, true, sun_shade_frac); #endif reflect_color *= sun_shade_frac * 0.75 + 0.25;