mitsuba-renderer / mitsuba3

Mitsuba 3: A Retargetable Forward and Inverse Renderer
https://www.mitsuba-renderer.org/
Other
2.02k stars 231 forks source link

Incorrect albedo rendered by AOV integrator with normal mapping #862

Closed gao-duan closed 1 year ago

gao-duan commented 1 year ago

Summary

I was trying to render the albedo for a diffuse object (or other materials) with normal mapping applied using an AOV integrator. However, the rendered result looks incorrect to me (there is obvious shading involved).

After debugging, I thought this is a bug in NormalMap BSDF. The NormalMap BSDF has not overridden the eval_diffuse_reflectance interface, and what I expected was something like (the same implementation as BumpMap):

Spectrum eval_diffuse_reflectance(const SurfaceInteraction3f &si, Mask active) const override {
        return m_nested_bsdf->eval_diffuse_reflectance(si, active);
}

System configuration

System information:

OS: Windows-10 CPU: Intel64 Family 6 Model 151 Stepping 2, GenuineIntel GPU: NVIDIA GeForce RTX 3090 Python: 3.10.9 | packaged by Anaconda, Inc. | (main, Mar 1 2023, 18:18:15) [MSC v.1916 64 bit (AMD64)] NVidia driver: 531.61 CUDA: 11.6.124 LLVM: 16.0.0

Dr.Jit: 0.4.2 Mitsuba: 3.3.0 Is custom build? False Compiled with: MSVC 19.35.32217.1 Variants: scalar_rgb scalar_spectral cuda_ad_rgb llvm_ad_rgb

njroussel commented 1 year ago

Hi @gao-duan

You are correct. I pushed a fix in this commit: https://github.com/mitsuba-renderer/mitsuba3/commit/3f6bfe0df8ba31c55cd769f347ab4d9f750c569d

Thank you!