mojira.dev
MC-310757

In OIT shaders, `coefficients[0]` is accumulated using `depth` but subtracted using `originalDepth`

In oit_add_transmittance.glsl, line 12~15,

float depth = originalDepth * float(OIT_NUMBER_OF_DEPTH_BINS - 1) / OIT_NUMBER_OF_DEPTH_BINS;

float averageAbsorbance = absorbance * (1 - depth);
coefficients[0] = averageAbsorbance; // accumulated using variable depth

In oit_sample.glsl, line 11~16,

float averageAbsorbance = coefficients[0];
if (averageAbsorbance == 0) {
    return 0.0;
}
float currentAverageAbsorbanceContribution = currentAbsorbance * (1 - originalDepth);
averageAbsorbance -= currentAverageAbsorbanceContribution; // subtracted using variable originalDepth

“coefficients[0]” should be accumulated and subtracted using “depth” in order to correctly exclude the factor contributed by the same depth.

Comments 0

No comments.

xuyifan

rabrandt

Confirmed

Platform G

Normal

Rendering

26.3 Snapshot 7

26.3 Snapshot 8

Retrieved