diff --git a/include/mitsuba/render/texture.h b/include/mitsuba/render/texture.h
index 12faf49d..9c1f1b52 100644
--- a/include/mitsuba/render/texture.h
+++ b/include/mitsuba/render/texture.h
@@ -48,6 +48,7 @@ public:
* two \ref Spectrum data structures corresponding to the U and V derivative.
*
* \remark This function is usually implemented pointwise without any kind of filtering.
+ * The Python signature is dx, dy = tex.evalGradient(its).
*/
virtual void evalGradient(const Intersection &its, Spectrum *gradient) const;
diff --git a/src/libpython/render.cpp b/src/libpython/render.cpp
index 3bc25afd..70f0560f 100644
--- a/src/libpython/render.cpp
+++ b/src/libpython/render.cpp
@@ -21,6 +21,12 @@ static const Intersection &bsdfsamplingrecord_get_its(const BSDFSamplingRecord &
return bRec.its;
}
+static bp::tuple texture_evalGradient(const Texture *texture, const Intersection &its) {
+ Spectrum grad[2];
+ texture->evalGradient(its, grad);
+ return bp::make_tuple(grad[0], grad[1]);
+}
+
static unsigned int bsdf_getType_1(const BSDF *bsdf) {
return bsdf->getType();
}
@@ -301,6 +307,8 @@ bp::tuple Sensor_getSamplePosition(Sensor *sensor, const PositionSamplingRecord
return bp::make_tuple(result, samplePos);
}
+BOOST_PYTHON_MEMBER_FUNCTION_OVERLOADS(getBitmap_overloads, getBitmap, 0, 1)
+
void export_render() {
bp::object renderModule(
bp::handle<>(bp::borrowed(PyImport_AddModule("mitsuba.render"))));
@@ -756,12 +764,16 @@ void export_render() {
BP_CLASS(Texture, ConfigurableObject, bp::no_init)
.def("eval", &Texture::eval, BP_RETURN_VALUE)
+ .def("evalGradient", &texture_evalGradient)
.def("getAverage", &Texture::getAverage, BP_RETURN_VALUE)
.def("getMinimum", &Texture::getMinimum, BP_RETURN_VALUE)
.def("getMaximum", &Texture::getMaximum, BP_RETURN_VALUE)
.def("getResolution", &Texture::getResolution, BP_RETURN_VALUE)
.def("isConstant", &Texture::isConstant)
- .def("usesRayDifferentials", &Texture::usesRayDifferentials);
+ .def("isMonochromatic", &Texture::isMonochromatic)
+ .def("expand", &Texture::expand, BP_RETURN_VALUE)
+ .def("usesRayDifferentials", &Texture::usesRayDifferentials)
+ .def("getBitmap", &Texture::getBitmap, getBitmap_overloads()[BP_RETURN_VALUE]);
bp::class_("Noise")
.def("perlinNoise", &Noise::perlinNoise)