mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Added reflection mode settings
This commit is contained in:
parent
b85fd11443
commit
40e47b4f3e
@ -25,8 +25,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
||||
- Pets can now be traded with.
|
||||
- Crafting recipe for black lantern
|
||||
- Added redwood and dead trees
|
||||
- Experimental screen-space reflection and refraction shaders
|
||||
- Water will now move according to its apparent flow direction
|
||||
- Added screen-space reflection and refraction shaders
|
||||
- Added reflection quality setting
|
||||
|
||||
### Changed
|
||||
- Use fluent for translations
|
||||
|
@ -72,9 +72,13 @@ hud-settings-antialiasing_mode = AntiAliasing Mode
|
||||
hud-settings-upscale_factor = Internal Resolution
|
||||
hud-settings-cloud_rendering_mode = Cloud Rendering Mode
|
||||
hud-settings-fluid_rendering_mode = Fluid Rendering Mode
|
||||
hud-settings-fluid_rendering_mode-cheap = Cheap
|
||||
hud-settings-fluid_rendering_mode-low = Low
|
||||
hud-settings-fluid_rendering_mode-medium = Medium
|
||||
hud-settings-fluid_rendering_mode-high = High
|
||||
hud-settings-reflection_rendering_mode = Reflection Rendering Mode
|
||||
hud-settings-reflection_rendering_mode-low = Low
|
||||
hud-settings-reflection_rendering_mode-medium = Medium
|
||||
hud-settings-reflection_rendering_mode-high = High
|
||||
hud-settings-cloud_rendering_mode-minimal = Minimal
|
||||
hud-settings-cloud_rendering_mode-low = Low
|
||||
hud-settings-cloud_rendering_mode-medium = Medium
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#define LIGHTING_REFLECTION_KIND LIGHTING_REFLECTION_KIND_SPECULAR
|
||||
|
||||
#if (FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#if (FLUID_MODE == FLUID_MODE_LOW)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_IMPORTANCE
|
||||
#elif (FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_RADIANCE
|
||||
@ -92,11 +92,12 @@ void main() {
|
||||
float cloud_blend = 1.0;
|
||||
if (color.a < 1.0) {
|
||||
vec2 nz = vec2(0);
|
||||
#ifdef EXPERIMENTAL_SCREENSPACEREFRACTION
|
||||
uvec2 col_sz = textureSize(sampler2D(t_src_color, s_src_color), 0);
|
||||
#if (REFLECTION_MODE >= REFLECTION_MODE_MEDIUM)
|
||||
nz = (vec2(
|
||||
noise_3d(vec3((wpos.xy + focus_off.xy) * 0.1, tick.x * 0.2 + wpos.x * 0.01)).x,
|
||||
noise_3d(vec3((wpos.yx + focus_off.yx) * 0.1, tick.x * 0.2 + wpos.y * 0.01)).x
|
||||
) - 0.5) * color.a;
|
||||
) - 0.5) * (dir.z < 0.0 ? color.a : 1.0);
|
||||
|
||||
const float n2 = 1.3325;
|
||||
vec3 refr_dir;
|
||||
@ -105,33 +106,25 @@ void main() {
|
||||
// vec3 surf_norm = normalize(vec3(nz * 0.03 / (1.0 + dist * 0.1), 1));
|
||||
// refr_dir = refract(dir, surf_norm * -sign(dir.z), 1.0 / n2);
|
||||
// } else {
|
||||
refr_dir = normalize(dir + vec3(nz / dist, 0.0));
|
||||
refr_dir = normalize(dir + vec3(nz * 1.5 / dist, 0.0));
|
||||
// }
|
||||
|
||||
vec4 clip = (all_mat * vec4(cam_pos.xyz + refr_dir, 1.0));
|
||||
vec2 new_uv = (clip.xy / max(clip.w, 0)) * 0.5 * vec2(1, -1) + 0.5;
|
||||
|
||||
float uv_merge = clamp((1.0 - abs(new_uv.y - 0.5) * 2) * 5.0, 0, 1);
|
||||
new_uv = mix(uv, new_uv, uv_merge);
|
||||
|
||||
uvec2 sz = textureSize(sampler2D(t_src_color, s_src_color), 0);
|
||||
vec4 new_col = texelFetch(sampler2D(t_src_color, s_src_color), clamp(ivec2(mix(uv, new_uv, uv_merge) * sz), ivec2(0), ivec2(sz) - 1), 0);
|
||||
vec4 new_col = texelFetch(sampler2D(t_src_color, s_src_color), clamp(ivec2(new_uv * col_sz), ivec2(0), ivec2(col_sz) - 1), 0);
|
||||
if (new_col.a < 1.0) {
|
||||
color = new_col;
|
||||
dir = refr_dir;
|
||||
}
|
||||
#else
|
||||
#if (FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
if (dir.z < 0.0) {
|
||||
nz = (vec2(
|
||||
noise_3d(vec3((wpos.xy + focus_off.xy) * 0.1, tick.x * 0.2 + wpos.x * 0.01)).x,
|
||||
noise_3d(vec3((wpos.yx + focus_off.yx) * 0.1, tick.x * 0.2 + wpos.y * 0.01)).x
|
||||
) - 0.5);
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
{
|
||||
cloud_blend = 1.0 - color.a;
|
||||
|
||||
#ifdef EXPERIMENTAL_SCREENSPACEREFLECTIONS
|
||||
#if (FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
if (dir.z < 0.0) {
|
||||
vec3 surf_norm = normalize(vec3(nz * 0.3 / (1.0 + dist * 0.1), 1));
|
||||
vec3 refl_dir = reflect(dir, surf_norm);
|
||||
@ -139,7 +132,7 @@ void main() {
|
||||
vec4 clip = (all_mat * vec4(cam_pos.xyz + refl_dir, 1.0));
|
||||
vec2 new_uv = (clip.xy / max(clip.w, 0)) * 0.5 * vec2(1, -1) + 0.5;
|
||||
|
||||
#ifdef EXPERIMENTAL_SCREENSPACEREFLECTIONSCASTING
|
||||
#if (REFLECTION_MODE >= REFLECTION_MODE_HIGH)
|
||||
vec3 ray_end = wpos + refl_dir * 5.0 * dist;
|
||||
// Trace through the screen-space depth buffer to find the ray intersection
|
||||
const int MAIN_ITERS = 64;
|
||||
@ -153,7 +146,7 @@ void main() {
|
||||
float d = -depth_at(suv);
|
||||
if (d < svpos.z * 0.8 && d > svpos.z * 0.999) {
|
||||
// Don't cast into water!
|
||||
if (texture(sampler2D(t_src_color, s_src_color), suv).a >= 1.0) {
|
||||
if (texelFetch(sampler2D(t_src_color, s_src_color), clamp(ivec2(suv * col_sz), ivec2(0), ivec2(col_sz) - 1), 0).a >= 1.0) {
|
||||
/* t -= 1.0 / float(MAIN_ITERS); */
|
||||
// Do a bit of extra iteration to try to refine the estimate
|
||||
const int ITERS = 8;
|
||||
@ -187,23 +180,19 @@ void main() {
|
||||
);
|
||||
|
||||
if (merge > 0.0) {
|
||||
vec3 new_col = texture(sampler2D(t_src_color, s_src_color), new_uv).rgb;
|
||||
vec3 new_col = texelFetch(sampler2D(t_src_color, s_src_color), clamp(ivec2(new_uv * col_sz), ivec2(0), ivec2(col_sz) - 1), 0).rgb;
|
||||
new_col = get_cloud_color(new_col.rgb, refl_dir, wpos, time_of_day.x, distance(new_wpos, wpos.xyz), 1.0);
|
||||
color.rgb = mix(color.rgb, new_col, merge * color.a);
|
||||
cloud_blend = 1;
|
||||
} else {
|
||||
cloud_blend = 1;
|
||||
color.rgb = mix(color.rgb, new_col, min(merge * (color.a * 2.0), 1.0));
|
||||
}
|
||||
cloud_blend = 1;
|
||||
} else {
|
||||
#else
|
||||
{
|
||||
#endif
|
||||
cloud_blend = 1;
|
||||
//dist = DIST_CAP;
|
||||
}
|
||||
}
|
||||
}
|
||||
/* color.rgb = vec3(sin(depth_at(uv) * 3.14159 * 2) * 0.5 + 0.5); */
|
||||
color.rgb = mix(color.rgb, get_cloud_color(color.rgb, dir, cam_pos.xyz, time_of_day.x, dist, 1.0), cloud_blend);
|
||||
|
||||
#if (CLOUD_MODE == CLOUD_MODE_NONE)
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#define LIGHTING_REFLECTION_KIND LIGHTING_REFLECTION_KIND_SPECULAR
|
||||
|
||||
#if (FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#if (FLUID_MODE == FLUID_MODE_LOW)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_IMPORTANCE
|
||||
#elif (FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_RADIANCE
|
||||
|
@ -8,7 +8,7 @@
|
||||
|
||||
#define LIGHTING_REFLECTION_KIND LIGHTING_REFLECTION_KIND_GLOSSY
|
||||
|
||||
#if (FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#if (FLUID_MODE == FLUID_MODE_LOW)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_IMPORTANCE
|
||||
#elif (FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_RADIANCE
|
||||
@ -139,7 +139,7 @@ void main() {
|
||||
float moon_shade_frac = horizon_at(f_pos, moon_dir); */
|
||||
#if (SHADOW_MODE == SHADOW_MODE_CHEAP || SHADOW_MODE == SHADOW_MODE_MAP || FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
float f_alt = alt_at(f_pos.xy);
|
||||
#elif (SHADOW_MODE == SHADOW_MODE_NONE || FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#elif (SHADOW_MODE == SHADOW_MODE_NONE || FLUID_MODE == FLUID_MODE_LOW)
|
||||
float f_alt = f_pos.z;
|
||||
#endif
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#define LIGHTING_REFLECTION_KIND LIGHTING_REFLECTION_KIND_SPECULAR
|
||||
|
||||
#if (FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#if (FLUID_MODE == FLUID_MODE_LOW)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_IMPORTANCE
|
||||
#elif (FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_RADIANCE
|
||||
@ -114,7 +114,7 @@ void main() {
|
||||
vec3 moon_dir = get_moon_dir(time_of_day.x); */
|
||||
#if (SHADOW_MODE == SHADOW_MODE_CHEAP || SHADOW_MODE == SHADOW_MODE_MAP || FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
float f_alt = alt_at(f_pos.xy);
|
||||
#elif (SHADOW_MODE == SHADOW_MODE_NONE || FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#elif (SHADOW_MODE == SHADOW_MODE_NONE || FLUID_MODE == FLUID_MODE_LOW)
|
||||
float f_alt = f_pos.z;
|
||||
#endif
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#define LIGHTING_REFLECTION_KIND LIGHTING_REFLECTION_KIND_SPECULAR
|
||||
|
||||
#if (FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#if (FLUID_MODE == FLUID_MODE_LOW)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_IMPORTANCE
|
||||
#elif (FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_RADIANCE
|
||||
@ -80,14 +80,16 @@ vec4 wave_height(vec4 posx, vec4 posy) {
|
||||
float speed = 1.0;
|
||||
posx *= 0.2;
|
||||
posy *= 0.2;
|
||||
const float drag_factor = 0.03;
|
||||
const float iters = 21;
|
||||
const float drag_factor = 0.035;
|
||||
const int iters = 21;
|
||||
const float scale = 25.0;
|
||||
#else
|
||||
float speed = 2.0;
|
||||
posx *= 0.3;
|
||||
posy *= 0.3;
|
||||
const float drag_factor = 0.04;
|
||||
const float iters = 11;
|
||||
const int iters = 11;
|
||||
const float scale = 5.0;
|
||||
#endif
|
||||
const float iter_shift = (3.14159 * 2.0) / 7.3;
|
||||
|
||||
@ -104,7 +106,7 @@ vec4 wave_height(vec4 posx, vec4 posy) {
|
||||
phase *= 1.2;
|
||||
speed += speed_per_iter;
|
||||
}
|
||||
return w / ws * 5.0;
|
||||
return w / ws * scale;
|
||||
}
|
||||
|
||||
float wave_height_vel(vec2 pos) {
|
||||
@ -213,7 +215,7 @@ void main() {
|
||||
vec3 water_color = (1.0 - MU_WATER) * MU_SCATTER;
|
||||
#if (SHADOW_MODE == SHADOW_MODE_CHEAP || SHADOW_MODE == SHADOW_MODE_MAP || FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
float f_alt = alt_at(f_pos.xy);
|
||||
#elif (SHADOW_MODE == SHADOW_MODE_NONE || FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#elif (SHADOW_MODE == SHADOW_MODE_NONE || FLUID_MODE == FLUID_MODE_LOW)
|
||||
float f_alt = f_pos.z;
|
||||
#endif
|
||||
|
||||
@ -266,7 +268,7 @@ void main() {
|
||||
// float shade_frac = /*1.0;*/sun_shade_frac + moon_shade_frac;
|
||||
|
||||
vec3 reflect_color;
|
||||
#if (FLUID_MODE == FLUID_MODE_HIGH)
|
||||
#if (REFLECTION_MODE >= REFLECTION_MODE_MEDIUM)
|
||||
reflect_color = get_sky_color(ray_dir, time_of_day.x, f_pos, vec3(-100000), 0.125, true, 1.0, true, sun_shade_frac);
|
||||
reflect_color = get_cloud_color(reflect_color, ray_dir, f_pos.xyz, time_of_day.x, 100000.0, 0.1);
|
||||
#else
|
||||
@ -408,7 +410,11 @@ void main() {
|
||||
min_refl = min(emitted_light.r, min(emitted_light.g, emitted_light.b));
|
||||
} else {
|
||||
// Hack to make the opacity of the surface fade when underwater to avoid artifacts
|
||||
opacity = min(sqrt(max(opacity, clamp((f_pos.z - cam_pos.z) * 0.05, 0.0, 1.0))), 1.0);
|
||||
if (dot(refract_ray_dir, cam_to_frag) > 0.0) {
|
||||
opacity = 0.99;
|
||||
} else {
|
||||
opacity = min(sqrt(max(opacity, clamp((f_pos.z - cam_pos.z) * 0.05, 0.0, 1.0))), 0.99);
|
||||
}
|
||||
}
|
||||
vec4 color = vec4(surf_color, opacity);// * (1.0 - /*log(1.0 + cam_attenuation)*//*cam_attenuation*/1.0 / (2.0 - log_cam)));
|
||||
// vec4 color = vec4(surf_color, mix(1.0, 1.0 / (1.0 + /*0.25 * *//*diffuse_light*/(/*f_light * point_shadow*/reflected_light_point)), passthrough));
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#define LIGHTING_REFLECTION_KIND LIGHTING_REFLECTION_KIND_SPECULAR
|
||||
|
||||
#if (FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#if (FLUID_MODE == FLUID_MODE_LOW)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_IMPORTANCE
|
||||
#elif (FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_RADIANCE
|
||||
|
@ -232,9 +232,6 @@ vec3 get_cloud_color(vec3 surf_color, vec3 dir, vec3 origin, const float time_of
|
||||
vec3 moon_color = get_moon_color();
|
||||
|
||||
// Clouds aren't visible underwater
|
||||
#ifdef IS_POSTPROCESS
|
||||
if (medium.x != 1) {
|
||||
#endif
|
||||
float cdist = max_dist;
|
||||
float ldist = cdist;
|
||||
// i is an emergency brake
|
||||
@ -315,9 +312,6 @@ vec3 get_cloud_color(vec3 surf_color, vec3 dir, vec3 origin, const float time_of
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
#ifdef IS_POSTPROCESS
|
||||
}
|
||||
#endif
|
||||
|
||||
// Underwater light attenuation
|
||||
surf_color = water_diffuse(surf_color, dir, max_dist);
|
||||
|
@ -6,10 +6,14 @@
|
||||
#define VOXYGEN_COMPUTATION_PREFERENCE_FRAGMENT 0
|
||||
#define VOXYGEN_COMPUTATION_PREFERENCE_VERTEX 1
|
||||
|
||||
#define FLUID_MODE_CHEAP 0
|
||||
#define FLUID_MODE_LOW 0
|
||||
#define FLUID_MODE_MEDIUM 1
|
||||
#define FLUID_MODE_HIGH 2
|
||||
|
||||
#define REFLECTION_MODE_LOW 0
|
||||
#define REFLECTION_MODE_MEDIUM 1
|
||||
#define REFLECTION_MODE_HIGH 2
|
||||
|
||||
#define CLOUD_MODE_NONE 0
|
||||
#define CLOUD_MODE_MINIMAL 1
|
||||
#define CLOUD_MODE_LOW 2
|
||||
|
@ -138,7 +138,7 @@ float alt_at(vec2 pos) {
|
||||
|
||||
float alt_at_real(vec2 pos) {
|
||||
// Basic idea: only really need the real altitude for an accurate water height estimation, so if we are in the cheap shader take a shortcut.
|
||||
// #if (FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
// #if (FLUID_MODE == FLUID_MODE_LOW)
|
||||
// return alt_at(pos);
|
||||
// #elif (FLUID_MODE == FLUID_MODE_SHINY)
|
||||
return (/*round*/(textureBicubic16(t_alt, s_alt, pos_to_tex(pos)).r * (/*1300.0*//*1278.7266845703125*/view_distance.w)) + /*140.0*/view_distance.z - focus_off.z);
|
||||
|
@ -503,7 +503,12 @@ float is_star_at(vec3 dir) {
|
||||
|
||||
//return 0.0;
|
||||
|
||||
return 50.0 * max(sun_dir.z, 0.1) / (1.0 + pow(dist * 750, 8));
|
||||
#if (CLOUD_MODE == CLOUD_MODE_NONE)
|
||||
const float power = 5.0;
|
||||
#else
|
||||
const float power = 50.0;
|
||||
#endif
|
||||
return power * max(sun_dir.z, 0.1) / (1.0 + pow(dist * 750, 8));
|
||||
}
|
||||
|
||||
vec3 get_sky_light(vec3 dir, float time_of_day, bool with_stars) {
|
||||
@ -624,21 +629,22 @@ vec3 get_sky_color(vec3 dir, float time_of_day, vec3 origin, vec3 f_pos, float q
|
||||
vec3 moon_halo_color = MOON_HALO_COLOR;
|
||||
|
||||
float moon_halo_power = 20.0;
|
||||
|
||||
vec3 moon_surf = vec3(0);
|
||||
if (with_features) {
|
||||
float angle = 0.00035;
|
||||
moon_surf = clamp((dot(dir, -moon_dir) - (1.0 - angle)) * 4 / angle, 0, 1) * MOON_SURF_COLOR;
|
||||
}
|
||||
#if (CLOUD_MODE == CLOUD_MODE_NONE)
|
||||
if (true) {
|
||||
#else
|
||||
if (fake_clouds || medium.x == MEDIUM_WATER) {
|
||||
#endif
|
||||
moon_halo_power = 50.0;
|
||||
moon_halo_color *= 0.02;
|
||||
moon_halo_color *= 0.2;
|
||||
moon_surf *= 0.05;
|
||||
}
|
||||
|
||||
vec3 moon_halo = moon_halo_color * pow(max(dot(dir, -moon_dir), 0), moon_halo_power);
|
||||
vec3 moon_surf = vec3(0);
|
||||
if (with_features) {
|
||||
float angle = 0.00035;
|
||||
moon_surf = clamp((dot(dir, -moon_dir) - (1.0 - angle)) * 4 / angle, 0, 1) * MOON_SURF_COLOR;
|
||||
}
|
||||
vec3 moon_light = moon_halo + moon_surf;
|
||||
|
||||
// Replaced all clamp(sun_dir, 0, 1) with max(sun_dir, 0) because sun_dir is calculated from sin and cos, which are never > 1
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#define LIGHTING_REFLECTION_KIND LIGHTING_REFLECTION_KIND_GLOSSY
|
||||
|
||||
#if (FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#if (FLUID_MODE == FLUID_MODE_LOW)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_IMPORTANCE
|
||||
#elif (FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_RADIANCE
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#define LIGHTING_REFLECTION_KIND LIGHTING_REFLECTION_KIND_GLOSSY
|
||||
|
||||
#if (FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#if (FLUID_MODE == FLUID_MODE_LOW)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_IMPORTANCE
|
||||
#elif (FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_RADIANCE
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
#define LIGHTING_REFLECTION_KIND LIGHTING_REFLECTION_KIND_GLOSSY
|
||||
|
||||
#if (FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#if (FLUID_MODE == FLUID_MODE_LOW)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_IMPORTANCE
|
||||
#elif (FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_RADIANCE
|
||||
|
@ -11,7 +11,7 @@
|
||||
|
||||
#define LIGHTING_REFLECTION_KIND LIGHTING_REFLECTION_KIND_GLOSSY
|
||||
|
||||
#if (FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#if (FLUID_MODE == FLUID_MODE_LOW)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_IMPORTANCE
|
||||
#elif (FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_RADIANCE
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#define LIGHTING_REFLECTION_KIND LIGHTING_REFLECTION_KIND_GLOSSY
|
||||
|
||||
#if (FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#if (FLUID_MODE == FLUID_MODE_LOW)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_IMPORTANCE
|
||||
#elif (FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_RADIANCE
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#define LIGHTING_REFLECTION_KIND LIGHTING_REFLECTION_KIND_GLOSSY
|
||||
|
||||
#if (FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#if (FLUID_MODE == FLUID_MODE_LOW)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_IMPORTANCE
|
||||
#elif (FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_RADIANCE
|
||||
@ -43,7 +43,7 @@ void main() {
|
||||
|
||||
#if (SHADOW_MODE == SHADOW_MODE_CHEAP || SHADOW_MODE == SHADOW_MODE_MAP || FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
float f_alt = alt_at(f_pos.xy);
|
||||
#elif (SHADOW_MODE == SHADOW_MODE_NONE || FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#elif (SHADOW_MODE == SHADOW_MODE_NONE || FLUID_MODE == FLUID_MODE_LOW)
|
||||
float f_alt = f_pos.z;
|
||||
#endif
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#define LIGHTING_REFLECTION_KIND LIGHTING_REFLECTION_KIND_GLOSSY
|
||||
|
||||
#if (FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#if (FLUID_MODE == FLUID_MODE_LOW)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_IMPORTANCE
|
||||
#elif (FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_RADIANCE
|
||||
@ -448,7 +448,7 @@ void main() {
|
||||
#if (SHADOW_MODE == SHADOW_MODE_CHEAP || SHADOW_MODE == SHADOW_MODE_MAP || FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
float shadow_alt = /*f_pos.z;*/alt_at(f_pos.xy);//max(alt_at(f_pos.xy), f_pos.z);
|
||||
// float shadow_alt = f_pos.z;
|
||||
#elif (SHADOW_MODE == SHADOW_MODE_NONE || FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#elif (SHADOW_MODE == SHADOW_MODE_NONE || FLUID_MODE == FLUID_MODE_LOW)
|
||||
float shadow_alt = f_pos.z;
|
||||
#endif
|
||||
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#define LIGHTING_REFLECTION_KIND LIGHTING_REFLECTION_KIND_GLOSSY
|
||||
|
||||
#if (FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#if (FLUID_MODE == FLUID_MODE_LOW)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_IMPORTANCE
|
||||
#elif (FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_RADIANCE
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#define LIGHTING_REFLECTION_KIND LIGHTING_REFLECTION_KIND_GLOSSY
|
||||
|
||||
#if (FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#if (FLUID_MODE == FLUID_MODE_LOW)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_IMPORTANCE
|
||||
#elif (FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_RADIANCE
|
||||
@ -44,7 +44,7 @@ void main() {
|
||||
|
||||
#if (SHADOW_MODE == SHADOW_MODE_CHEAP || SHADOW_MODE == SHADOW_MODE_MAP || FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
float f_alt = alt_at(f_pos.xy);
|
||||
#elif (SHADOW_MODE == SHADOW_MODE_NONE || FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#elif (SHADOW_MODE == SHADOW_MODE_NONE || FLUID_MODE == FLUID_MODE_LOW)
|
||||
float f_alt = f_pos.z;
|
||||
#endif
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#define LIGHTING_REFLECTION_KIND LIGHTING_REFLECTION_KIND_GLOSSY
|
||||
|
||||
#if (FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#if (FLUID_MODE == FLUID_MODE_LOW)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_IMPORTANCE
|
||||
#elif (FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_RADIANCE
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#define LIGHTING_REFLECTION_KIND LIGHTING_REFLECTION_KIND_SPECULAR
|
||||
|
||||
#if (FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#if (FLUID_MODE == FLUID_MODE_LOW)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_IMPORTANCE
|
||||
#elif (FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_RADIANCE
|
||||
@ -288,7 +288,7 @@ void main() {
|
||||
|
||||
vec4 final_color = aa_color;
|
||||
|
||||
#if (FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#if (FLUID_MODE == FLUID_MODE_LOW)
|
||||
if (medium.x == MEDIUM_WATER) {
|
||||
final_color *= vec4(0.2, 0.2, 0.8, 1.0);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#define LIGHTING_REFLECTION_KIND LIGHTING_REFLECTION_KIND_SPECULAR
|
||||
|
||||
#if (FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#if (FLUID_MODE == FLUID_MODE_LOW)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_IMPORTANCE
|
||||
#elif (FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_RADIANCE
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#define LIGHTING_REFLECTION_KIND LIGHTING_REFLECTION_KIND_GLOSSY
|
||||
|
||||
#if (FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#if (FLUID_MODE == FLUID_MODE_LOW)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_IMPORTANCE
|
||||
#elif (FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_RADIANCE
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
#define LIGHTING_REFLECTION_KIND LIGHTING_REFLECTION_KIND_GLOSSY
|
||||
|
||||
#if (FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#if (FLUID_MODE == FLUID_MODE_LOW)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_IMPORTANCE
|
||||
#elif (FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_RADIANCE
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#define LIGHTING_REFLECTION_KIND LIGHTING_REFLECTION_KIND_SPECULAR
|
||||
|
||||
#if (FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#if (FLUID_MODE == FLUID_MODE_LOW)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_IMPORTANCE
|
||||
#elif (FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_RADIANCE
|
||||
@ -55,5 +55,5 @@ void main() {
|
||||
} */
|
||||
vec3 wpos = cam_pos.xyz + /*normalize(f_pos)*/cam_dir * dist;
|
||||
|
||||
tgt_color = vec4(cam_attenuation * get_sky_color(normalize(f_pos), time_of_day.x, cam_pos.xyz, wpos, 1.0, medium.x != MEDIUM_WATER, refractionIndex), 1.0);
|
||||
tgt_color = vec4(cam_attenuation * get_sky_color(normalize(f_pos), time_of_day.x, cam_pos.xyz, wpos, 1.0, true, refractionIndex, false, 1.0), 1.0);
|
||||
}
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#define LIGHTING_REFLECTION_KIND LIGHTING_REFLECTION_KIND_SPECULAR
|
||||
|
||||
#if (FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#if (FLUID_MODE == FLUID_MODE_LOW)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_IMPORTANCE
|
||||
#elif (FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_RADIANCE
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#define LIGHTING_REFLECTION_KIND LIGHTING_REFLECTION_KIND_GLOSSY
|
||||
|
||||
#if (FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#if (FLUID_MODE == FLUID_MODE_LOW)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_IMPORTANCE
|
||||
#elif (FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_RADIANCE
|
||||
@ -53,7 +53,7 @@ void main() {
|
||||
|
||||
#if (SHADOW_MODE == SHADOW_MODE_CHEAP || SHADOW_MODE == SHADOW_MODE_MAP || FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
float f_alt = alt_at(f_pos.xy);
|
||||
#elif (SHADOW_MODE == SHADOW_MODE_NONE || FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#elif (SHADOW_MODE == SHADOW_MODE_NONE || FLUID_MODE == FLUID_MODE_LOW)
|
||||
float f_alt = f_pos.z;
|
||||
#endif
|
||||
|
||||
|
@ -7,7 +7,7 @@
|
||||
|
||||
#define LIGHTING_REFLECTION_KIND LIGHTING_REFLECTION_KIND_GLOSSY
|
||||
|
||||
#if (FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#if (FLUID_MODE == FLUID_MODE_LOW)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_IMPORTANCE
|
||||
#elif (FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_RADIANCE
|
||||
@ -211,7 +211,7 @@ void main() {
|
||||
|
||||
#if (SHADOW_MODE == SHADOW_MODE_CHEAP || SHADOW_MODE == SHADOW_MODE_MAP || FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
float f_alt = alt_at(f_pos.xy);
|
||||
#elif (SHADOW_MODE == SHADOW_MODE_NONE || FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#elif (SHADOW_MODE == SHADOW_MODE_NONE || FLUID_MODE == FLUID_MODE_LOW)
|
||||
float f_alt = f_pos.z;
|
||||
#endif
|
||||
|
||||
@ -234,7 +234,7 @@ void main() {
|
||||
// Toggle to see rain_occlusion
|
||||
// tgt_color = vec4(rain_occlusion_at(f_pos.xyz), 0.0, 0.0, 1.0);
|
||||
// return;
|
||||
#ifdef EXPERIMENTAL_PUDDLES
|
||||
#if (REFLECTION_MODE >= REFLECTION_MODE_HIGH)
|
||||
float f_alpha = 1.0;
|
||||
#else
|
||||
const float f_alpha = 1.0;
|
||||
@ -249,17 +249,17 @@ void main() {
|
||||
drop_pos.z *= 0.5 + hash_fast(uvec3(cell2d, 0));
|
||||
vec3 cell = vec3(cell2d, floor(drop_pos.z * drop_density.z));
|
||||
|
||||
#ifdef EXPERIMENTAL_PUDDLES
|
||||
float puddle = clamp((noise_2d((f_pos.xy + focus_off.xy + vec2(0.1, 0)) * 0.03) - 0.5) * 20.0, 0.0, 1.0)
|
||||
#if (REFLECTION_MODE >= REFLECTION_MODE_HIGH)
|
||||
float puddle = clamp((noise_2d((f_pos.xy + focus_off.xy + vec2(0.1, 0)) * 0.02) - 0.5) * 20.0, 0.0, 1.0)
|
||||
* min(rain_density * 10.0, 1.0)
|
||||
* clamp((f_sky_exposure - 0.95) * 50.0, 0.0, 1.0);
|
||||
#else
|
||||
const float puddle = 1.0;
|
||||
#endif
|
||||
|
||||
#ifdef EXPERIMENTAL_PUDDLES
|
||||
#if (REFLECTION_MODE >= REFLECTION_MODE_HIGH)
|
||||
if (puddle > 0.0) {
|
||||
f_alpha = puddle * 0.3 * max(1.0 + cam_to_frag.z, 0.3);
|
||||
f_alpha = puddle * 0.2 * max(1.0 + cam_to_frag.z, 0.3);
|
||||
#ifdef EXPERIMENTAL_PUDDLEDETAILS
|
||||
float h = (noise_2d((f_pos.xy + focus_off.xy) * 0.3) - 0.5) * sin(tick.x * 8.0 + f_pos.x * 3)
|
||||
+ (noise_2d((f_pos.xy + focus_off.xy) * 0.6) - 0.5) * sin(tick.x * 3.5 - f_pos.y * 6);
|
||||
@ -287,10 +287,6 @@ void main() {
|
||||
k_d += distort;
|
||||
k_s += distort;
|
||||
|
||||
#ifdef EXPERIMENTAL_PUDDLES
|
||||
/* puddle = mix(puddle, 1.0, distort * 10); */
|
||||
#endif
|
||||
|
||||
f_norm.xy += (drop_pos - near_cell).xy
|
||||
* max(1.0 - abs(dist - drop_rad) * 30, 0)
|
||||
* 500.0
|
||||
@ -377,7 +373,7 @@ void main() {
|
||||
float not_underground = clamp((f_pos.z - f_alt) / 128.0 + 1.0, 0.0, 1.0);
|
||||
|
||||
// To account for prior saturation
|
||||
#if (FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#if (FLUID_MODE == FLUID_MODE_LOW)
|
||||
f_light = f_light * sqrt(f_light);
|
||||
#else
|
||||
f_light = faces_fluid ? not_underground : f_light * sqrt(f_light);
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#define LIGHTING_REFLECTION_KIND LIGHTING_REFLECTION_KIND_GLOSSY
|
||||
|
||||
#if (FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#if (FLUID_MODE == FLUID_MODE_LOW)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_IMPORTANCE
|
||||
#elif (FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_RADIANCE
|
||||
|
@ -6,7 +6,7 @@
|
||||
|
||||
#define LIGHTING_REFLECTION_KIND LIGHTING_REFLECTION_KIND_GLOSSY
|
||||
|
||||
#if (FLUID_MODE == FLUID_MODE_CHEAP)
|
||||
#if (FLUID_MODE == FLUID_MODE_LOW)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_IMPORTANCE
|
||||
#elif (FLUID_MODE >= FLUID_MODE_MEDIUM)
|
||||
#define LIGHTING_TRANSPORT_MODE LIGHTING_TRANSPORT_MODE_RADIANCE
|
||||
|
@ -7,7 +7,7 @@ use crate::{
|
||||
},
|
||||
render::{
|
||||
AaMode, BloomConfig, BloomFactor, BloomMode, CloudMode, FluidMode, LightingMode,
|
||||
PresentMode, RenderMode, ShadowMapMode, ShadowMode, UpscaleMode,
|
||||
PresentMode, ReflectionMode, RenderMode, ShadowMapMode, ShadowMode, UpscaleMode,
|
||||
},
|
||||
session::settings_change::Graphics as GraphicsChange,
|
||||
settings::Fps,
|
||||
@ -90,6 +90,8 @@ widget_ids! {
|
||||
cloud_mode_list,
|
||||
fluid_mode_text,
|
||||
fluid_mode_list,
|
||||
reflection_mode_text,
|
||||
reflection_mode_list,
|
||||
fullscreen_mode_text,
|
||||
fullscreen_mode_list,
|
||||
//
|
||||
@ -1038,10 +1040,10 @@ impl<'a> Widget for Video<'a> {
|
||||
.color(TEXT_COLOR)
|
||||
.set(state.ids.fluid_mode_text, ui);
|
||||
|
||||
let mode_list = [FluidMode::Cheap, FluidMode::Medium, FluidMode::High];
|
||||
let mode_list = [FluidMode::Low, FluidMode::Medium, FluidMode::High];
|
||||
let mode_label_list = [
|
||||
self.localized_strings
|
||||
.get_msg("hud-settings-fluid_rendering_mode-cheap"),
|
||||
.get_msg("hud-settings-fluid_rendering_mode-low"),
|
||||
self.localized_strings
|
||||
.get_msg("hud-settings-fluid_rendering_mode-medium"),
|
||||
self.localized_strings
|
||||
@ -1065,13 +1067,56 @@ impl<'a> Widget for Video<'a> {
|
||||
})));
|
||||
}
|
||||
|
||||
// ReflectionMode
|
||||
Text::new(
|
||||
&self
|
||||
.localized_strings
|
||||
.get_msg("hud-settings-reflection_rendering_mode"),
|
||||
)
|
||||
.down_from(state.ids.fluid_mode_list, 8.0)
|
||||
.font_size(self.fonts.cyri.scale(14))
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.color(TEXT_COLOR)
|
||||
.set(state.ids.reflection_mode_text, ui);
|
||||
|
||||
let mode_list = [
|
||||
ReflectionMode::Low,
|
||||
ReflectionMode::Medium,
|
||||
ReflectionMode::High,
|
||||
];
|
||||
let mode_label_list = [
|
||||
self.localized_strings
|
||||
.get_msg("hud-settings-reflection_rendering_mode-low"),
|
||||
self.localized_strings
|
||||
.get_msg("hud-settings-reflection_rendering_mode-medium"),
|
||||
self.localized_strings
|
||||
.get_msg("hud-settings-reflection_rendering_mode-high"),
|
||||
];
|
||||
|
||||
// Get which fluid rendering mode is currently active
|
||||
let selected = mode_list.iter().position(|x| *x == render_mode.reflection);
|
||||
|
||||
if let Some(clicked) = DropDownList::new(&mode_label_list, selected)
|
||||
.w_h(400.0, 22.0)
|
||||
.color(MENU_BG)
|
||||
.label_color(TEXT_COLOR)
|
||||
.label_font_id(self.fonts.cyri.conrod_id)
|
||||
.down_from(state.ids.reflection_mode_text, 8.0)
|
||||
.set(state.ids.reflection_mode_list, ui)
|
||||
{
|
||||
events.push(GraphicsChange::ChangeRenderMode(Box::new(RenderMode {
|
||||
reflection: mode_list[clicked],
|
||||
..render_mode.clone()
|
||||
})));
|
||||
}
|
||||
|
||||
// LightingMode
|
||||
Text::new(
|
||||
&self
|
||||
.localized_strings
|
||||
.get_msg("hud-settings-lighting_rendering_mode"),
|
||||
)
|
||||
.down_from(state.ids.fluid_mode_list, 8.0)
|
||||
.down_from(state.ids.reflection_mode_list, 8.0)
|
||||
.font_size(self.fonts.cyri.scale(14))
|
||||
.font_id(self.fonts.cyri.conrod_id)
|
||||
.color(TEXT_COLOR)
|
||||
|
@ -151,15 +151,15 @@ impl Default for CloudMode {
|
||||
/// Fluid modes
|
||||
#[derive(PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)]
|
||||
pub enum FluidMode {
|
||||
/// "Cheap" water. This water implements no waves, no reflections, no
|
||||
/// "Low" water. This water implements no waves, no reflections, no
|
||||
/// diffraction, and no light attenuation through water. As a result,
|
||||
/// it can be much cheaper than shiny reflection.
|
||||
Cheap,
|
||||
Low,
|
||||
High,
|
||||
/// "Shiny" water. This water implements waves on the surfaces, some
|
||||
/// attempt at reflections, and tries to compute accurate light
|
||||
/// attenuation through water (this is what results in the
|
||||
/// colors changing as you descend into deep water).
|
||||
/// This water implements waves on the surfaces, some attempt at
|
||||
/// reflections, and tries to compute accurate light attenuation through
|
||||
/// water (this is what results in the colors changing as you descend
|
||||
/// into deep water).
|
||||
///
|
||||
/// Unfortunately, the way the engine is currently set up, calculating
|
||||
/// accurate attenuation is a bit difficult; we use estimates from
|
||||
@ -180,6 +180,23 @@ impl Default for FluidMode {
|
||||
fn default() -> Self { FluidMode::Medium }
|
||||
}
|
||||
|
||||
/// Reflection modes
|
||||
#[derive(PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)]
|
||||
pub enum ReflectionMode {
|
||||
/// No or minimal reflections.
|
||||
Low,
|
||||
/// High quality reflections with screen-space raycasting and
|
||||
/// all the bells & whistles.
|
||||
High,
|
||||
// Medium quality screen-space reflections.
|
||||
#[serde(other)]
|
||||
Medium,
|
||||
}
|
||||
|
||||
impl Default for ReflectionMode {
|
||||
fn default() -> Self { ReflectionMode::Medium }
|
||||
}
|
||||
|
||||
/// Lighting modes
|
||||
#[derive(PartialEq, Eq, Clone, Copy, Debug, Serialize, Deserialize)]
|
||||
pub enum LightingMode {
|
||||
@ -359,6 +376,7 @@ impl BloomMode {
|
||||
pub struct RenderMode {
|
||||
pub aa: AaMode,
|
||||
pub cloud: CloudMode,
|
||||
pub reflection: ReflectionMode,
|
||||
pub fluid: FluidMode,
|
||||
pub lighting: LightingMode,
|
||||
pub shadow: ShadowMode,
|
||||
@ -382,6 +400,7 @@ impl Default for RenderMode {
|
||||
aa: AaMode::default(),
|
||||
cloud: CloudMode::default(),
|
||||
fluid: FluidMode::default(),
|
||||
reflection: ReflectionMode::default(),
|
||||
lighting: LightingMode::default(),
|
||||
shadow: ShadowMode::default(),
|
||||
rain_occlusion: ShadowMapMode::default(),
|
||||
@ -403,6 +422,7 @@ impl RenderMode {
|
||||
aa: self.aa,
|
||||
cloud: self.cloud,
|
||||
fluid: self.fluid,
|
||||
reflection: self.reflection,
|
||||
lighting: self.lighting,
|
||||
shadow: self.shadow,
|
||||
rain_occlusion: self.rain_occlusion,
|
||||
@ -427,6 +447,7 @@ pub struct PipelineModes {
|
||||
aa: AaMode,
|
||||
pub cloud: CloudMode,
|
||||
fluid: FluidMode,
|
||||
reflection: ReflectionMode,
|
||||
lighting: LightingMode,
|
||||
pub shadow: ShadowMode,
|
||||
pub rain_occlusion: ShadowMapMode,
|
||||
@ -498,15 +519,6 @@ pub enum ExperimentalShader {
|
||||
DirectionalShadowMapTexelGrid,
|
||||
/// Disable rainbows
|
||||
NoRainbows,
|
||||
/// Make the ground appear wet when appropriate.
|
||||
Puddles,
|
||||
/// Add extra detailing to puddles (requires [`Puddles`]).
|
||||
/// Add extra detailing to puddles.
|
||||
PuddleDetails,
|
||||
/// Add screen-space reflections to water.
|
||||
ScreenSpaceReflections,
|
||||
/// Use screen-space raycasting for reflections (requires
|
||||
/// [`ScreenSpaceReflections`]).
|
||||
ScreenSpaceReflectionsCasting,
|
||||
/// Add screen-space refractions to water.
|
||||
ScreenSpaceRefraction,
|
||||
}
|
||||
|
@ -6,8 +6,8 @@ use super::{
|
||||
blit, bloom, clouds, debug, figure, fluid, lod_object, lod_terrain, particle,
|
||||
postprocess, shadow, skybox, sprite, terrain, trail, ui,
|
||||
},
|
||||
AaMode, BloomMode, CloudMode, FluidMode, LightingMode, PipelineModes, RenderError,
|
||||
ShadowMode,
|
||||
AaMode, BloomMode, CloudMode, FluidMode, LightingMode, PipelineModes, ReflectionMode,
|
||||
RenderError, ShadowMode,
|
||||
},
|
||||
shaders::Shaders,
|
||||
ImmutableLayouts, Layouts,
|
||||
@ -173,6 +173,7 @@ impl ShaderModules {
|
||||
#define VOXYGEN_COMPUTATION_PREFERENCE {}
|
||||
#define FLUID_MODE {}
|
||||
#define CLOUD_MODE {}
|
||||
#define REFLECTION_MODE {}
|
||||
#define LIGHTING_ALGORITHM {}
|
||||
#define SHADOW_MODE {}
|
||||
|
||||
@ -181,7 +182,7 @@ impl ShaderModules {
|
||||
// TODO: Configurable vertex/fragment shader preference.
|
||||
"VOXYGEN_COMPUTATION_PREFERENCE_FRAGMENT",
|
||||
match pipeline_modes.fluid {
|
||||
FluidMode::Cheap => "FLUID_MODE_CHEAP",
|
||||
FluidMode::Low => "FLUID_MODE_LOW",
|
||||
FluidMode::Medium => "FLUID_MODE_MEDIUM",
|
||||
FluidMode::High => "FLUID_MODE_HIGH",
|
||||
},
|
||||
@ -193,6 +194,11 @@ impl ShaderModules {
|
||||
CloudMode::High => "CLOUD_MODE_HIGH",
|
||||
CloudMode::Ultra => "CLOUD_MODE_ULTRA",
|
||||
},
|
||||
match pipeline_modes.reflection {
|
||||
ReflectionMode::Low => "REFLECTION_MODE_LOW",
|
||||
ReflectionMode::Medium => "REFLECTION_MODE_MEDIUM",
|
||||
ReflectionMode::High => "REFLECTION_MODE_HIGH",
|
||||
},
|
||||
match pipeline_modes.lighting {
|
||||
LightingMode::Ashikhmin => "LIGHTING_ALGORITHM_ASHIKHMIN",
|
||||
LightingMode::BlinnPhong => "LIGHTING_ALGORITHM_BLINN_PHONG",
|
||||
@ -299,7 +305,7 @@ impl ShaderModules {
|
||||
};
|
||||
|
||||
let selected_fluid_shader = ["fluid-frag.", match pipeline_modes.fluid {
|
||||
FluidMode::Cheap => "cheap",
|
||||
FluidMode::Low => "cheap",
|
||||
_ => "shiny",
|
||||
}]
|
||||
.concat();
|
||||
|
Loading…
Reference in New Issue
Block a user