Skip to content

Commit

Permalink
Add PreliminaryIntersection, HitComputeFlags, ...
Browse files Browse the repository at this point in the history
- Add Shape::ray_intersect_preliminary
- Add Scene::ray_intersect_preliminary
- Rename Shape::fill_surface_interaction into
Shape::compute_surface_interaction
- Add support for differential SurfaceInteraction3f
- Add unit tests for differentiable SI
- Remove Shape::normal_derivative()
  • Loading branch information
Speierers committed Jul 17, 2020
1 parent c8a54db commit 87de032
Show file tree
Hide file tree
Showing 49 changed files with 4,700 additions and 2,371 deletions.
739 changes: 622 additions & 117 deletions include/mitsuba/python/docstr.h

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions include/mitsuba/python/python.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ PYBIND11_DECLARE_HOLDER_TYPE(T, mitsuba::ref<T>, true);
#define def_field(Class, Member, ...) \
def_readwrite(#Member, &Class::Member, ##__VA_ARGS__)

/// Shorthand notation for defining enum members
#define def_value(Class, Value, ...) \
value(#Value, Class::Value, D(Class, Value), ##__VA_ARGS__)

/// Shorthand notation for defining most kinds of methods
#define def_method(Class, Function, ...) \
def(#Function, &Class::Function, D(Class, Function), ##__VA_ARGS__)
Expand Down
2 changes: 1 addition & 1 deletion include/mitsuba/render/bsdf.h
Original file line number Diff line number Diff line change
Expand Up @@ -491,7 +491,7 @@ typename SurfaceInteraction<Float, Spectrum>::BSDFPtr SurfaceInteraction<Float,
/// differentials
if constexpr (!is_diff_array_v<Float>) {
if (!has_uv_partials() && any(bsdf->needs_differentials()))
compute_partials(ray);
compute_uv_partials(ray);
} else {
ENOKI_MARK_USED(ray);
}
Expand Down
45 changes: 24 additions & 21 deletions include/mitsuba/render/fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,30 +37,32 @@ template <typename Float, typename Spectrum> struct PositionSample;
template <typename Float, typename Spectrum> struct Interaction;
template <typename Float, typename Spectrum> struct SurfaceInteraction;
template <typename Float, typename Spectrum> struct MediumInteraction;
template <typename Float, typename Spectrum> struct PreliminaryIntersection;
template <typename Float, typename Spectrum> struct BSDFSample3;
template <typename Float, typename Spectrum> struct PhaseFunctionContext;


template <typename Float_, typename Spectrum_> struct RenderAliases {
using Float = Float_;
using Spectrum = Spectrum_;
using Float = Float_;
using Spectrum = Spectrum_;

using Wavelength = wavelength_t<Spectrum>;
using UnpolarizedSpectrum = depolarize_t<Spectrum>;
using Wavelength = wavelength_t<Spectrum>;
using UnpolarizedSpectrum = depolarize_t<Spectrum>;

using StokesVector4f = StokesVector<UnpolarizedSpectrum>;
using MuellerMatrix4f = MuellerMatrix<UnpolarizedSpectrum>;
using StokesVector4f = StokesVector<UnpolarizedSpectrum>;
using MuellerMatrix4f = MuellerMatrix<UnpolarizedSpectrum>;

using Ray3f = Ray<Point<Float, 3>, Spectrum>;
using RayDifferential3f = RayDifferential<Point<Float, 3>, Spectrum>;
using Ray3f = Ray<Point<Float, 3>, Spectrum>;
using RayDifferential3f = RayDifferential<Point<Float, 3>, Spectrum>;

using PositionSample3f = PositionSample<Float, Spectrum>;
using DirectionSample3f = DirectionSample<Float, Spectrum>;
using Interaction3f = Interaction<Float, Spectrum>;
using SurfaceInteraction3f = SurfaceInteraction<Float, Spectrum>;
using MediumInteraction3f = MediumInteraction<Float, Spectrum>;
using BSDFSample3f = BSDFSample3<Float, Spectrum>;
using PhaseFunctionContext = mitsuba::PhaseFunctionContext<Float, Spectrum>;
using PositionSample3f = PositionSample<Float, Spectrum>;
using DirectionSample3f = DirectionSample<Float, Spectrum>;
using Interaction3f = Interaction<Float, Spectrum>;
using SurfaceInteraction3f = SurfaceInteraction<Float, Spectrum>;
using MediumInteraction3f = MediumInteraction<Float, Spectrum>;
using PreliminaryIntersection3f = PreliminaryIntersection<Float, Spectrum>;
using BSDFSample3f = BSDFSample3<Float, Spectrum>;
using PhaseFunctionContext = mitsuba::PhaseFunctionContext<Float, Spectrum>;

/// Strip away any masking-related wrappers from 'Float' and 'Spectrum'
using FloatU = underlying_t<Float>;
Expand Down Expand Up @@ -113,12 +115,13 @@ template <typename Float_, typename Spectrum_> struct RenderAliases {

#define MTS_IMPORT_TYPES(...) \
MTS_IMPORT_RENDER_BASIC_TYPES() \
using PositionSample3f = typename RenderAliases::PositionSample3f; \
using DirectionSample3f = typename RenderAliases::DirectionSample3f; \
using Interaction3f = typename RenderAliases::Interaction3f; \
using SurfaceInteraction3f = typename RenderAliases::SurfaceInteraction3f; \
using MediumInteraction3f = typename RenderAliases::MediumInteraction3f; \
using BSDFSample3f = typename RenderAliases::BSDFSample3f; \
using PositionSample3f = typename RenderAliases::PositionSample3f; \
using DirectionSample3f = typename RenderAliases::DirectionSample3f; \
using Interaction3f = typename RenderAliases::Interaction3f; \
using SurfaceInteraction3f = typename RenderAliases::SurfaceInteraction3f; \
using MediumInteraction3f = typename RenderAliases::MediumInteraction3f; \
using PreliminaryIntersection3f = typename RenderAliases::PreliminaryIntersection3f; \
using BSDFSample3f = typename RenderAliases::BSDFSample3f; \
ENOKI_USING_TYPES(MTS_IMPORT_TYPES_HELPER(__VA_ARGS__))

#define MTS_IMPORT_OBJECT_TYPES() \
Expand Down
Loading

0 comments on commit 87de032

Please sign in to comment.