mmp / pbrt-v3

Source code for pbrt, the renderer described in the third edition of "Physically Based Rendering: From Theory To Implementation", by Matt Pharr, Wenzel Jakob, and Greg Humphreys.
http://pbrt.org
BSD 2-Clause "Simplified" License
4.87k stars 1.18k forks source link

Disney microfacet implementation is incorrect #224

Closed paulu closed 4 years ago

paulu commented 5 years ago

The specular highlights of the disney material are wrong.

The attached test scene consists of a white area light emitter and (1) a red dielectric ball, (2) a black dielectric ball and (3) a copper-like conductor ball (f_0 is [0.9 0.45 0.45]). From basic principles, the expected results are (1) white highlight, (2) white highlight, (3) highlight whose red is approximately twice the green and blue components.

The actual results (with the current master) are (1) red highlight, (2) no highlight and (3) highlight whose red >> 2 green or 2 blue.

These results are easily explained by this line of code: si->bsdf->Add(ARENA_ALLOC(arena, MicrofacetReflection)(c, distrib, fresnel)); which incorrectly multiplies the microfacet model by the base color. This causes (1) to pick up the red from the base color (2) to eliminate the highlight and (3) to make the effective material appear darker and applies a gamma-like effect to the relative proportions of the components.

Replacing c with 1.f achieves the correct result.

scene.txt

mmp commented 4 years ago

Thanks!!