-
Hi! Recently I posted a issue asking how to get some custom values (metallic, roughness...) of a principled BSDF in order to create a custom G-buffer, and with the release of Mitsuba 3.4 I was finally able to get those values. However, when doing some testing suddenly the code stopped working. Here's the custom integrator I've been using so far: class Metallic(mi.SamplingIntegrator):
def __init__(self, props):
mi.SamplingIntegrator.__init__(self, props)
def sample(self, scene: mi.Scene, sampler, ray: mi.RayDifferential3f, medium: mi.Medium = None,
active: bool = True) -> Tuple[mi.Color3f, bool, List[float]]:
si = scene.ray_intersect(ray=ray, active=active)
bsdf = si.bsdf(ray)
col_eval = bsdf.eval_attribute('metallic', si=si, active=active)
valid = si.is_valid()
color = dr.select(valid, col_eval, mi.Color3f(0.0, 0.0, 0.0))
return color, valid, [dr.select(valid, 1.0, 0.0)]
def aov_names(self) -> List[str]:
return ['metallic.M']
def to_string(self) -> str:
return 'MetallicIntegrator[]' Is there anything wrong with this code? (Including misconceptions or bad habits) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 7 replies
-
Hi @Frollo24 This all looks fine. I don't get this part of your message:
So this exact integrator was working once the release was done, but over the past weeks it "stopped"? What does "stopped" mean? Does it return random values? Zeroes? |
Beta Was this translation helpful? Give feedback.
Unfortunately, this is not supported currently
It wouldn't take much work to properly support it though. This is where all of this logic happens. Basically we would need an extra case in
put_object
to run the callback on the nested object too.Something like this might be enough:
I'd welcome a PR for this change if you …