mitsuba-renderer / mitsuba3

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

llvm_spectral_polarized the output _arg_0 is completely black #1132

Closed YanQiSun closed 7 months ago

YanQiSun commented 7 months ago

Hallo,

The xml document of the same scene outputs an ideal image in scalar_rgb. However, when I just enable llvm_spectral_polarized, the output image is all black, and the aov depth, normal vector and index image are output normally.

import mitsuba as mi
import matplotlib.pyplot as plt
import numpy as np

mi.set_variant('llvm_spectral_polarized')

scene = mi.load_file('/home/sun/pro/examples/debugging/temp/2.xml')

mi.render(scene, spp=256)
aov_names = scene.integrator().aov_names()
print("Available AOV Names:", aov_names)

bitmap = scene.sensors()[0].film().bitmap()
bitmap.write('/home/sun/pro/examples/debugging/temp/output.exr')

channels_dict = dict(bitmap.split())
print(channels_dict.keys())

if '_arg_0' in channels_dict:
    arg_0_bitmap = channels_dict['_arg_0']

    srgb_corrected_bitmap = arg_0_bitmap.convert(mi.Bitmap.PixelFormat.RGB, mi.Struct.Type.Float32, srgb_gamma=True)

    srgb_corrected_array = np.array(srgb_corrected_bitmap, copy=False)

    plt.figure(figsize=(5, 5))
    plt.imshow(srgb_corrected_array)
    plt.axis('off') 
    plt.show()

Can you tell me how to output _arg_0 correctly? Thanks a lot

YanQiSun commented 7 months ago

It's my problem. I forgot to change the value of value. After increasing it, it becomes normal.

njroussel commented 7 months ago

Hi @YanQiSun

Do you mind clarifying the following, it might help somone:

I forgot to change the value of value

Thanks

YanQiSun commented 7 months ago
    <integrator type="aov">
        <string name="aovs" value="dd.y:depth,nn:geo_normal,index:shape_index"/>
            <integrator type="stokes">
                <integrator type="volpath">
                    <integer name="max_depth" value="3"/>
                </integrator>
            </integrator>
    </integrator>

value=3 or bigger, do not = 0