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.89k stars 1.19k forks source link

"Metal" material doesn't support texture #271

Closed deadmarston closed 4 years ago

deadmarston commented 4 years ago

Hello,

I found that the "metal" material doesn't support texture, and I think it could be straightforwardly achieved by adding one line code in the MetalMaterial::ComputeScatteringFunctions change the final line from: si->bsdf->Add(ARENA_ALLOC(arena, MicrofacetReflection)(1., distrib, frMf); to: //the tex should be defined when the material is created si->bsdf->Add((ARENA_ALLOC(arena, MicrofacetReflection)(tex->Evaluate(*si), distrib, frMf);)

I wonder why pbrt decide not to support that? If there is a reason for that, could you explain it? Thanks and look forward to your reply :)

mmp commented 4 years ago

That isn't supported since it doesn't really correspond to anything meaningful physically; i.e., the color appearance of metals ends up coming from their index of refraction, which is specified via eta and k, which can be textures. Allowing a texture to modulate the microfacets themselves would I guess correspond to some sort of coating, which is beyond the goals of the metal material in its current form...