Add dithering when transitioning to raymarching lod.

This commit is contained in:
IntegratedQuantum 2023-09-22 11:52:21 +02:00
parent f0b5ba3249
commit 3d19feae42

View File

@ -227,7 +227,10 @@ bool passDitherTest(float alpha) {
void main() {
RayMarchResult result;
float variance = perpendicularFwidth(direction);
if(variance <= 4.0) {
const float threshold = 1;
const float interpolationRegion = 1.25;
float interp = (variance - threshold)/threshold/(interpolationRegion - 1);
if(!passDitherTest(interp)) {
result = rayMarching(startPosition, direction);
} else {
result = RayMarchResult(true, faceNormal, faceNormal, ivec3(startPosition)); // At some point it doesn't make sense to even draw the model.