Differentiable Silhouette Integrator #1176
-
Hi there, The aov integrator has a differentiable depth integrator and I was trying to modify it into a differentiable silhouette integrator but failed. A silhouette integrator should behave similarly to a depth integrator except it doesn't return the depth but 1 when a ray hit an object. Can you give me an idea of how to implement it? Or is there already an implementation that I didn't find? Currently, I have complicated workaround, which set the object's albedo to 0, remove all the light sources and set the object emission to 1. The result will look the same as that of a silhouette integrator and return the correct gradient. However, it doesn't fit into our pipeline well. Thanks in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Hi @GuangyanCai, case Type::Depth:
*aovs++ = dr::select(si.is_valid(), si.t, 0.f);
break; You can check if the depth is zero "dr.eq(depth, 0)" to tell if it hits any object. But from this definition the outcome is always binary and thus non-differentiable. Could you elaborate more about the "differentiable silhouette integrator"? |
Beta Was this translation helpful? Give feedback.
I see. It's for the shape mask loss.
This is very common in CV but is a little bit hard in CG, especially in a PBR renderer.
The correct way to do it in my mind is roughly as follows:
Render an aov channel of hit or not, compare with reference mask to know for every pixel should we see more or less of the shape. Note that this information will be very sparse, only non-zero on the visibility silhouettes.
To use the derivative, we cannot rely on autodiff and have to explicitly sample the silhouettes to compute some "boundary derivative". You can take a look at the "sppp" part of the logic in the projective integrator, which does roughly the s…