mitsuba-renderer / mitsuba3

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

An area emitter with texture initialization cannot generate correct illumination #1363

Closed AuroraRyan0301 closed 2 weeks ago

AuroraRyan0301 commented 3 weeks ago

Summary

I tried placing a diffuse object inside a closed sphere and applied an environment map to the closed sphere as a light source. It's kind of like the realization of spherical map. I reversed the sphere's normal direction (because of single-sided bsdf) and set the relevant area emitter properties. However, I found that when using a texture-initialized emitter, the foreground object appears much darker compared to the case with a fixed rgb value initialized emitter, even though the background color is the same (I set a constant value of 5.0).

System configuration

System information:

CPU: AMD EPYC 7713 64-Core Processor GPU: NVIDIA A100-SXM4-80GB Python: 3.8.10 (default, Mar 25 2024, 10:42:49) [GCC 9.4.0] NVidia driver: 550.127.05 CUDA: 10.1.243 LLVM: 12.0.0

Dr.Jit: 0.4.6 Mitsuba: 3.5.2 Is custom build? False Compiled with: GNU 10.2.1 Variants: scalar_rgb scalar_spectral cuda_ad_rgb llvm_ad_rgb

Description

In the case of the texture-initialized emitter, it seems that the ray, after reflecting off the central object, queries the environment's radiance incorrectly. However, the area emitter initialized with one fixed value aligns with theoretical predictions. I provided simple reproduction code (1 Jupyter notebook file and 2 XML files), and I’m not sure if there is an issue with the underlying textured emitter implementation. I also provided 2 exr images for comparison. Could you explain how this discrepancy arises? Thank you very much!

Steps to reproduce

1.unzip the following zip file 2.run mi3_comparison.ipynb bug.zip

AuroraRyan0301 commented 3 weeks ago

I also tried enabling the 'raw' option of bitmap texture and setting it to true, but the discrepancy still exists.

rtabbara commented 2 weeks ago

Hi @AuroraRyan0301 ,

I took a look and I'm fairly certain it's an issue with the mesh you're using for the area light. If I visualise the unwrapped UV map in blender

image

you can see that there's some UV overlapping across faces which in particular is going to be a problem when importance sampling a direction from the emitter with respect to the textured radiance.

I instead tried a different sphere mesh which I generated, and I get comparable results between the constant radiance and textured example, so I would recommend first trying to fix the mesh.

AuroraRyan0301 commented 2 weeks ago

Hi @AuroraRyan0301 ,

I took a look and I'm fairly certain it's an issue with the mesh you're using for the area light. If I visualise the unwrapped UV map in blender

image

you can see that there's some UV overlapping across faces which in particular is going to be a problem when importance sampling a direction from the emitter with respect to the textured radiance.

I instead tried a different sphere mesh which I generated, and I get comparable results between the constant radiance and textured example, so I would recommend first trying to fix the mesh.

Hi Rami,

Thank you for your feedback! Ohhh, it seems that I did overlooked the mesh overlapping😀. I took a closer look at the UV mapping and fixed the overlapping issues in the mesh, and that resolved everything! Now I’m getting comparable results between the constant radiance and textured examples.

Thank you again for your precious time and kind help.