diff --git a/Compositor/HDR/hdr.xml b/Compositor/HDR/hdr.xml index b38719090..0d523eb60 100644 --- a/Compositor/HDR/hdr.xml +++ b/Compositor/HDR/hdr.xml @@ -101,7 +101,7 @@ aerial-perspective 2d - 512 + 1024 32 rgba16f linear diff --git a/Shaders/HDR/atmos-aerial-perspective.frag b/Shaders/HDR/atmos-aerial-perspective.frag index c9be8cc8e..fc18d71c9 100644 --- a/Shaders/HDR/atmos-aerial-perspective.frag +++ b/Shaders/HDR/atmos-aerial-perspective.frag @@ -26,8 +26,8 @@ uniform sampler2D multiscattering_lut; const float PI = 3.141592653; const float ATMOSPHERE_RADIUS = 6471e3; -const float TOTAL_SLICES = 16.0; -const float DEPTH_RANGE = 32000.0; +const float TOTAL_SLICES = 32.0; +const float DEPTH_RANGE = 128000.0; const int AERIAL_PERSPECTIVE_SAMPLES = 20; const vec3 ONE_OVER_THREE = vec3(1.0 / 3.0); diff --git a/Shaders/HDR/lighting.frag b/Shaders/HDR/lighting.frag index 3d1a95a6a..752848088 100644 --- a/Shaders/HDR/lighting.frag +++ b/Shaders/HDR/lighting.frag @@ -44,10 +44,10 @@ const vec2 uv_shifts[4] = vec2[4]( vec2(0.0, 0.5), vec2(0.5, 0.5)); const vec2 uv_factor = vec2(0.5, 0.5); -const float AERIAL_SLICES = 16.0; +const float AERIAL_SLICES = 32.0; const float AERIAL_LUT_TILE_SIZE = 1.0 / AERIAL_SLICES; -const float AERIAL_LUT_TEXEL_SIZE = 1.0 / 512.0; -const float AERIAL_MAX_DEPTH = 32000.0; +const float AERIAL_LUT_TEXEL_SIZE = 1.0 / 1024.0; +const float AERIAL_MAX_DEPTH = 128000.0; const float MAX_PREFILTERED_LOD = 4.0; @@ -348,17 +348,16 @@ vec4 sampleAerialPerspective(float depth) float w = depth / AERIAL_MAX_DEPTH; // Squared distribution w = sqrt(clamp(w, 0.0, 1.0)); - // Remap to [0,16] to sample the right tile w *= AERIAL_SLICES; if (w <= 1.0) { // Handle special case of fragments behind the first slice color = mix(vec4(0.0, 0.0, 0.0, 1.0), sampleAerialPerspectiveSlice(0), w); } else { - w -= 1.0; // [0,15] - // Manually linearly interpolate between slices + w -= 1.0; + // Manually interpolate between slices color = mix(sampleAerialPerspectiveSlice(int(floor(w))), sampleAerialPerspectiveSlice(int(ceil(w))), - fract(w)); + sqrt(fract(w))); } return color; }