Skip to content

Commit

Permalink
Expose PhaseFunction of Medium with mi.traverse()
Browse files Browse the repository at this point in the history
  • Loading branch information
njroussel committed Dec 29, 2022
1 parent 7e7d7b9 commit cca5791
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 0 deletions.
2 changes: 2 additions & 0 deletions include/mitsuba/render/medium.h
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,8 @@ class MI_EXPORT_LIB Medium : public Object {
return m_has_spectral_extinction;
}

void traverse(TraversalCallback *callback) override;

/// Return a string identifier
std::string id() const override { return m_id; }

Expand Down
1 change: 1 addition & 0 deletions src/media/heterogeneous.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Heterogeneous medium (:monosp:`heterogeneous`)
- A nested phase function that describes the directional scattering properties of
the medium. When none is specified, the renderer will automatically use an instance of
isotropic.
- |exposed|, |differentiable|


This plugin provides a flexible heterogeneous medium implementation, which acquires its data
Expand Down
1 change: 1 addition & 0 deletions src/media/homogeneous.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ Homogeneous medium (:monosp:`homogeneous`)
- A nested phase function that describes the directional scattering properties of
the medium. When none is specified, the renderer will automatically use an instance of
isotropic.
- |exposed|, |differentiable|

This class implements a homogeneous participating medium with support for arbitrary
phase functions. This medium can be used to model effects such as fog or subsurface scattering.
Expand Down
4 changes: 4 additions & 0 deletions src/render/medium.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,10 @@ MI_VARIANT Medium<Float, Spectrum>::Medium(const Properties &props) : m_id(props

MI_VARIANT Medium<Float, Spectrum>::~Medium() {}

MI_VARIANT void Medium<Float, Spectrum>::traverse(TraversalCallback *callback) {
callback->put_object("phase_function", m_phase_function.get(), +ParamFlags::Differentiable);
}

MI_VARIANT
typename Medium<Float, Spectrum>::MediumInteraction3f
Medium<Float, Spectrum>::sample_interaction(const Ray3f &ray, Float sample,
Expand Down

0 comments on commit cca5791

Please sign in to comment.