File tree Expand file tree Collapse file tree
code/def_files/data/effects Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,9 +6,11 @@ float compress_depth_value(float linear) {
66 linear = max(-linear, 0.0);
77
88 if(linear < 10.0) {
9- linear_mult = 0.00000999908;
10- exponent_mult = 1.32878452580;
11- offset = 0.0;
9+ //Special handling for very close values. For smooth shadows at very close distances, equidistant steps get too inaccurate.
10+ //Scaling this down linearly will push more accuracy to closer distances. Due to the scaling, this does not lose accuracy
11+ //at any point over the worse of uncompressed / z-compress, but it does trade the gained accuracy from compression at 10m
12+ //distance for accuracy lost due to compression below 0.5m (roughly)
13+ return linear * 0.01;
1214 }
1315 else if (linear < 100.0) {
1416 linear_mult = 0.05550473078;
@@ -70,9 +72,7 @@ float uncompress_depth_value(float compressed) {
7072 offset = 3000.0;
7173 }
7274 else if (compressed < 0.1) {
73- linear_mult = 0.00000999908;
74- exponent_mult = 1.32878452580;
75- offset = 0.0;
75+ return compressed * -100.0;
7676 }
7777 else if (compressed < 20.0) {
7878 linear_mult = 0.05550473078;
You can’t perform that action at this time.
0 commit comments