the number of channels fixed in the sample function in spectral mode?
free7187 opened this issue · 1 comments
Summary
I'm debugging rendering in spectral mode in Python and have set
mi.set_variant('cuda_ad_rgb')
Initially, I configured a BSDF with 30-channel reflectance. However, during the debugging process, I noticed that the return value of bsdf_sample()
only has 4 channels. Based on this, I also tried a 30-channel emitter, but the em_weight returned by sample_emitter()
also has 4 channels.
This behavior differs from my original expectation. So, during rendering in spectral mode, is the number of channels in the sample function fixed at 4 channels, even if the material parameters may be set to have more channels?
System configuration
System information:
OS: Windows-10
CPU: Intel64 Family 6 Model 183 Stepping 1, GenuineIntel
GPU: NVIDIA GeForce RTX 4090
Python: 3.10.14 | packaged by Anaconda, Inc. | (main, Mar 21 2024, 16:20:14) [MSC v.1916 64 bit (AMD64)]
NVidia driver: 536.25
CUDA: 11.8.89
LLVM: 15.-1.-1
Dr.Jit: 0.4.4
Mitsuba: 3.5.0
Steps to reproduce
1.here is my test function
class real_data_integrator(mi.SamplingIntegrator):
def __init__(self, props):
super().__init__(props)
def sample(self,
scene: mi.Scene,
sampler:mi.Sampler,
ray: mi.RayDifferential3f,
medium: mi.Medium = None,
active: bool = True) -> tuple[mi.Color3f, bool, list[float]]:
L = mi.Spectrum(0.0)
# ---------------------- Direct emission ----------------------
si = scene.ray_intersect(ray, active)
bsdf_ctx = mi.BSDFContext()
sample1 = sampler.next_1d()
sample2 = sampler.next_2d()
bsdf: mi.BSDF = si.bsdf()
bsdf_sample, bsdf_weight = bsdf.sample(
bsdf_ctx, si, sample1, sample2)
self.shape_confirm(bsdf_weight)
valid_ray = active & si.is_valid()
active &= si.is_valid()
cosThetaI = mi.Frame3f.cos_theta(si.wi)
active &= (cosThetaI>0)
# Sample the emitter
ds, em_weight = scene.sample_emitter_direction(
si, sampler.next_2d(), True, active
)
active &= ds.pdf != 0.0
self.shape_confirm(em_weight)
return dr.select(True, L, 0.0), valid_ray, []
@dr.wrap(source='drjit', target='torch')
def shape_confirm(self,em_weight):
print(em_weight.shape)