mitsuba2
mitsuba2 copied to clipboard
- [❔ other question] Add differentiable parameter to shape
Summary
How to add a differentiable parameter to an existing shape?
Description
I am trying to make the radius of a sphere differentiable, any hint on how to achieve this? Which parts of the code should I modify to make it work?
Hi @chx125ck ,
In the current codebase this will require a few changes in sphere.cpp
. First you will need to set the type of m_radius
to Float
. Then make sure it is properly exposed and handled in the traverse()
and parameters_changed()
method. You will probably need to change the update()
method as well so that it doesn't overwrite m_radius
.
More importantly, you will need to use the path-reparam
integrator in order to correctly account for the discontinuities in the light transport equation when differentiating w.r.t. such parameter. Please see the pathreparam-optix7 branch for this.