Ok, I did more perceptual tests, then some analysis, using DREAM RC4 and no post processing mod on my screen (1080p).pango wrote: ↑Mon May 06, 2019 9:09 pm Modifying the code was easy: https://github.com/petchema/daggerfall- ... map-levels
But I'm not quite sure what to look at
First I checked that a mipmap level of 8.0 looked smooth in the distance: that works.
Then I checked how far the transition between level 7.0 and 8.0 could be pushed away before aliasing appears. In my tests, 50.0 was about right.
Then I checked how far the transition between level 0.0 and 7.0 could be pushed away before aliasing appears. In my tests, 4.5 was close to the max.
But what's the scale between the two? I assume the goal is to keep the angular diameter of pixels about constant. Pixel widths varies according to 1/d, but their height decreases faster because the surface also appears more and more tilted (from camera point of view). I spare you the details, but height seems to vary in 1/d².
Mipmap scale is logarithmic (vs pixel size), so you end up with level = const -2 log2(d)
In other words, you should gain one mipmap level each time the distance increases by a sqrt(2) factor.
And it matches almost perfectly with the two bounds found perceptually!
Code: Select all
float mipMapLevel;
if (dist < 4.375f)
mipMapLevel = 0.0;
else if (dist < 6.25f)
mipMapLevel = 1.0;
else if (dist < 8.75f)
mipMapLevel = 2.0;
else if (dist < 12.5f)
mipMapLevel = 3.0;
else if (dist < 17.5f)
mipMapLevel = 4.0;
else if (dist < 25.0f)
mipMapLevel = 5.0;
else if (dist < 35.0f)
mipMapLevel = 6.0;
else if (dist < 50.0f)
mipMapLevel = 7.0;
else
mipMapLevel = 8.0;