Comment out lod depth tweaks not designed for reverse depth, convert waves image to rgba before constructing a texture, misc fix after rebase

This commit is contained in:
Imbris 2021-04-21 21:20:04 -04:00 committed by Avi Weinstock
parent c8bbe2dc0f
commit 18044d142d
3 changed files with 17 additions and 5 deletions

View File

@ -136,7 +136,7 @@ vec4 cloud_at(vec3 pos, float dist, out vec3 emission) {
#if (CLOUD_MODE >= CLOUD_MODE_MEDIUM)
emission_alt += (noise_3d(vec3(wind_pos.xy * 0.0005 + cloud_tendency * 0.2, emission_alt * 0.0001 + time_of_day.x * 0.001)) - 0.5) * 1000;
#endif
float tail = (textureLod(sampler2D(t_noise, s_noise), wind_pos.xy * 0.00005).x - 0.5, 0) * 4 + (pos.z - emission_alt) * 0.0001;
float tail = (textureLod(sampler2D(t_noise, s_noise), wind_pos.xy * 0.00005, 0).x - 0.5, 0) * 4 + (pos.z - emission_alt) * 0.0001;
vec3 emission_col = vec3(0.8 + tail * 1.5, 0.5 - tail * 0.2, 0.3 + tail * 0.2);
float emission_nz = max(pow(textureLod(sampler2D(t_noise, s_noise), wind_pos.xy * 0.000015, 0).x, 8), 0.01) * 0.25 / (10.0 + abs(pos.z - emission_alt) / 80);
emission = emission_col * emission_nz * emission_strength * max(sun_dir.z, 0) * 500000 / (1000.0 + abs(pos.z - emission_alt) * 0.1);

View File

@ -44,8 +44,11 @@ void main() {
// f_shadow = textureBicubic(t_horizon, pos_to_tex(f_pos.xy));
float dist = distance(focus_pos.xy, f_pos.xy);
pull_down = 0.2 / pow(dist / (view_distance.x * 0.9), 20.0);
// TODO: disabled because it isn't designed to work with reverse depth
//float dist = distance(focus_pos.xy, f_pos.xy);
//pull_down = 0.2 / pow(dist / (view_distance.x * 0.9), 20.0);
pull_down = 1.0 / pow(distance(focus_pos.xy, f_pos.xy) / (view_distance.x * 0.95), 20.0);
f_pos.z -= pull_down;
// f_pos.z -= 100.0 * pow(1.0 + 0.01 / view_distance.x, -pow(distance(focus_pos.xy, f_pos.xy), 2.0));
@ -95,7 +98,9 @@ void main() {
all_mat *
vec4(f_pos/*newRay*/, 1);
// Pull up the depth to avoid drawing over voxels (biased according to VD)
gl_Position.z += 0.1 * clamp((view_distance.x * 1.0 - dist) * 0.01, 0, 1);
// TODO: disabled because it isn't designed to work with reverse depth
//gl_Position.z += 0.1 * clamp((view_distance.x * 1.0 - dist) * 0.01, 0, 1);
// gl_Position.z = -gl_Position.z / gl_Position.w;
// gl_Position.z = -gl_Position.z / gl_Position.w;
// gl_Position.z = -gl_Position.z * gl_Position.w;

View File

@ -568,7 +568,14 @@ impl<V: RectRasterableVol> Terrain<V> {
waves: {
let waves_tex = renderer
.create_texture(
&assets::Image::load_expect("voxygen.texture.waves").read().0,
// TODO: actually this is unused, remove?
// TODO: re-add alpha channel?
&image::DynamicImage::ImageRgba8(
assets::Image::load_expect("voxygen.texture.waves")
.read()
.0
.to_rgba8(),
),
Some(wgpu::FilterMode::Linear),
Some(wgpu::AddressMode::Repeat),
)