mitsuba-renderer / mitsuba3

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

Properties or scene loading tries to convert 3x3 Tensor to Array3f #1280

Closed dvicini closed 3 months ago

dvicini commented 3 months ago

The following code prints a warning:

nanobind: implicit conversion from type 'TensorXf' to type 'drjit.scalar.Array3f64' failed!
import mitsuba as mi
import numpy as np

mi.set_variant('llvm_ad_rgb')

class MyEmitter(mi.Emitter):

    def __init__(self, props):
        super().__init__(props)
        print(props['test'])

mi.register_emitter('myemitter', lambda props: MyEmitter(props))

emitter = mi.load_dict({'type': 'myemitter', 'test': mi.TensorXf(np.ones((3,3), dtype=np.float32))})

For some reason, it tries to convert the mi.TensorXf to Array3f64. I've tried using mi.TensorXd instead, but this didn't change anything either. I can't reproduce this when only using a mi.Properties object in isolation, so it seems at least somewhat related to scene loading?

I am not sure how problematic this warning is in practice, but this conversion attempt is a bit suspicious and hints at something not being 100% right here.

njroussel commented 3 months ago

Fixed with #1285