pbrt-v4 icon indicating copy to clipboard operation
pbrt-v4 copied to clipboard

Roughness to alpha

Open curtisblack opened this issue 11 months ago • 2 comments

Hi all, just wanted to double check something. In the roughness to alpha conversion: https://github.com/mmp/pbrt-v4/blob/88645ffd6a451bd030d062a55a70a701c58a55d0/src/pbrt/util/scattering.h#L192 It has alpha = sqrt(roughness).

Is this a typo and should it be alpha=sqr(roughness) to match: https://reference.wolfram.com/language/tutorial/PhysicallyBasedRendering.html.en or is that reference incorrect?

curtisblack avatar Jan 17 '25 01:01 curtisblack

I think you are correct. I believe the original inspiration for mapping alpha = roughness^2 comes from

https://media.disneyanimation.com/uploads/production/publication_asset/48/asset/s2012_pbs_disney_brdf_notes_v3.pdf

For roughness, we found that mapping α = roughness^2 results in a more perceptually linear change in the roughness. Without this remapping, very small and non-intuitive values were required for matching shiny materials. Also, interpolating between a rough and smooth material would always produce a rough result.

shadeops avatar Jan 19 '25 20:01 shadeops

Ugh. Thanks for digging that up, @shadeops. I agree that the code is incorrect but my inclination at this point is to leave it as is so as to not change the appearance of rendered images of existing pbrt-v4 scenes that use "roughness". I tested a frame of zero day with the fix; the first image is top-of-tree and the second has the fix. Unsurprisingly, it's a pretty big difference visually.

top-of-tree pbrt

pbrt with RoughnessToAlphaFixed

mmp avatar Jan 30 '25 15:01 mmp