Skip to content

Commit

Permalink
Change Shape::parameters_grad_enabled to only consider parameters w…
Browse files Browse the repository at this point in the history
…hich introduce visibilty discontinuities
  • Loading branch information
njroussel committed Mar 5, 2024
1 parent f307675 commit 3013adb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
4 changes: 3 additions & 1 deletion include/mitsuba/render/shape.h
Original file line number Diff line number Diff line change
Expand Up @@ -937,7 +937,9 @@ class MI_EXPORT_LIB Shape : public Object {
friend class Scene<Float, Spectrum>;
friend class ShapeGroup<Float, Spectrum>;

/// Return whether any shape's parameters require gradients (default return false)
/** \brief Return whether any shape's parameters that introduce visibility
* discontinuities require gradients (default return false)
*/
virtual bool parameters_grad_enabled() const;

//! @}
Expand Down
8 changes: 1 addition & 7 deletions src/render/mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1850,13 +1850,7 @@ MI_VARIANT void Mesh<Float, Spectrum>::optix_build_input(OptixBuildInput &build_
#endif

MI_VARIANT bool Mesh<Float, Spectrum>::parameters_grad_enabled() const {
bool result = false;
for (auto &[name, attribute]: m_mesh_attributes)
result |= dr::grad_enabled(attribute.buf);
result |= dr::grad_enabled(m_vertex_positions);
result |= dr::grad_enabled(m_vertex_normals);
result |= dr::grad_enabled(m_vertex_texcoords);
return result;
return dr::grad_enabled(m_vertex_positions);
}

MI_IMPLEMENT_CLASS_VARIANT(Mesh, Shape)
Expand Down

0 comments on commit 3013adb

Please sign in to comment.