Skip to content

Commit a9bedb3

Browse files
njrousseldenghilbert
authored andcommitted
Fix Mesh update log message
Regenerate documentation (addition of `LargeSteps`) Expose m_film member in Sensor python bindings Add basic tests for LargeSteps Update tutorials submodule - fixed broken links Fix resources paths in test_largesteps.py Check for cholespy module before running tests Fix incorrect example in `measured.cpp` file. Unmark thinlens parameters as differentiable add color_ramp Add Color_ramp Add Color Ramp color interpolation with single factor Add Color Ramp color interpolation with bitmap Fix Color Ramp interpolate weight Fix color ramp bitmap interpolate systematic deviation Add Color Ramp color interpolate with gray (1 channel) bitmap Rename interpolate with single/bitmap functions' name Add another RGB2Gray method for ColorRamp to transform Color3f to Float Add ColorRamp for roughness, specular, metallic, and etc. Float spatially varying variable in BSDF Add ColorRamp for cuda_ad_mono Fix bug of single factor (distinguish from single channel bitmap factor) in ColoRamp Add Constant interpolation for ColorRamp Add Catmull-Rom splines (similar to Cardinal in Blender) for ColorRamp Add ease (not sure which kind) interpolation for ColorRamp Fix linear interpolate typo in ColorRamp Add Ease interpolation for ColorRamp Add weight function for cardinal and b-splines interpolation of ColorRamp Fix start index from 0 Add dr::gather support for Class Texture Add multi texture pos gather | Add ease and linear interpolation for multi-nodes Add b_splines and constant for multi nodes| Add boundary check Delete checking case for linear interpolation Complete 3 channel texture all interpolation types Add all for single factor or 1 channel | Difference with Blender on key_curve_position_weights Add different order derivative for cardinal and b_splines Remove color ramp for bump and normal bsdf Cleanup Add pytest for color_ramp Clean up ColorRamp Clean up
1 parent c99acb7 commit a9bedb3

File tree

19 files changed

+2672
-815
lines changed

19 files changed

+2672
-815
lines changed

docs/docs_api/list_api.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -540,6 +540,8 @@
540540

541541
.. autoclass:: mitsuba.ad.Adam
542542

543+
.. autoclass:: mitsuba.ad.LargeSteps
544+
543545
.. autoclass:: mitsuba.ad.Optimizer
544546

545547
.. autoclass:: mitsuba.ad.SGD
@@ -550,6 +552,10 @@
550552

551553
.. autofunction:: mitsuba.ad.common.mis_weight
552554

555+
.. autoclass:: mitsuba.ad.largesteps.SolveCholesky
556+
557+
.. autofunction:: mitsuba.ad.largesteps.mesh_laplacian
558+
553559
.. autofunction:: mitsuba.ad.reparameterize_ray
554560

555561
.. autofunction:: mitsuba.chi2.BSDFAdapter
@@ -824,6 +830,8 @@
824830

825831
.. autofunction:: mitsuba.variant
826832

833+
.. autofunction:: mitsuba.variant_context
834+
827835
.. autofunction:: mitsuba.variants
828836

829837
.. autofunction:: mitsuba.warp.beckmann_to_square

docs/generated/extracted_rst_api.rst

Lines changed: 187 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -4297,6 +4297,13 @@
42974297
Returns → bool:
42984298
*no description available*
42994299

4300+
.. py:method:: mitsuba.Emitter.sampling_weight(self)
4301+
4302+
The emitter's sampling weight.
4303+
4304+
Returns → float:
4305+
*no description available*
4306+
43004307
.. py:class:: mitsuba.EmitterFlags
43014308

43024309
This list of flags is used to classify the different types of
@@ -4676,6 +4683,13 @@
46764683
In the case of emitters, the weight will include the emitted
46774684
radiance.
46784685

4686+
.. py:method:: mitsuba.EmitterPtr.sampling_weight(self)
4687+
4688+
The emitter's sampling weight.
4689+
4690+
Returns → drjit.llvm.ad.Float:
4691+
*no description available*
4692+
46794693
.. py:method:: mitsuba.EmitterPtr.select_(arg0, arg1, arg2)
46804694

46814695
Parameter ``arg0`` (drjit.llvm.ad.Bool):
@@ -10668,19 +10682,19 @@
1066810682

1066910683
.. py:data:: mitsuba.MI_VERSION
1067010684
:type: str
10671-
:value: 3.2.1
10685+
:value: 3.3.0
1067210686

1067310687
.. py:data:: mitsuba.MI_VERSION_MAJOR
1067410688
:type: int
1067510689
:value: 3
1067610690

1067710691
.. py:data:: mitsuba.MI_VERSION_MINOR
1067810692
:type: int
10679-
:value: 2
10693+
:value: 3
1068010694

1068110695
.. py:data:: mitsuba.MI_VERSION_PATCH
1068210696
:type: int
10683-
:value: 1
10697+
:value: 0
1068410698

1068510699
.. py:data:: mitsuba.MI_YEAR
1068610700
:type: str
@@ -17860,25 +17874,19 @@
1786017874

1786117875
.. py:method:: mitsuba.Shape.eval_attribute(self, name, si, active=True)
1786217876

17863-
Evaluate a specific shape attribute at the given surface interaction.
17864-
17865-
Shape attributes are user-provided fields that provide extra
17866-
information at an intersection. An example of this would be a per-
17867-
vertex or per-face color on a triangle mesh.
17877+
Returns whether this shape contains the specified attribute.
1786817878

1786917879
Parameter ``name`` (str):
1787017880
Name of the attribute to evaluate
1787117881

1787217882
Parameter ``si`` (:py:obj:`mitsuba.SurfaceInteraction`):
17873-
Surface interaction associated with the query
17883+
*no description available*
1787417884

1787517885
Parameter ``active`` (drjit.llvm.ad.Bool):
1787617886
Mask to specify active lanes.
1787717887

1787817888
Returns → :py:obj:`mitsuba.Color3f`:
17879-
An unpolarized spectral power distribution or reflectance value
17880-
17881-
The default implementation throws an exception.
17889+
*no description available*
1788217890

1788317891
.. py:method:: mitsuba.Shape.eval_attribute_1(self, name, si, active=True)
1788417892

@@ -17901,8 +17909,6 @@
1790117909
Returns → drjit.llvm.ad.Float:
1790217910
An scalar intensity or reflectance value
1790317911

17904-
The default implementation throws an exception.
17905-
1790617912
.. py:method:: mitsuba.Shape.eval_attribute_3(self, name, si, active=True)
1790717913

1790817914
Trichromatic evaluation of a shape attribute at the given surface
@@ -17924,8 +17930,6 @@
1792417930
Returns → :py:obj:`mitsuba.Color3f`:
1792517931
An trichromatic intensity or reflectance value
1792617932

17927-
The default implementation throws an exception.
17928-
1792917933
.. py:method:: mitsuba.Shape.eval_parameterization(self, uv, ray_flags=14, active=True)
1793017934

1793117935
Parameterize the mesh using UV values
@@ -17953,6 +17957,28 @@
1795317957
Returns → :py:obj:`mitsuba.Medium`:
1795417958
*no description available*
1795517959

17960+
.. py:method:: mitsuba.Shape.has_attribute(self, name, active=True)
17961+
17962+
Evaluate a specific shape attribute at the given surface interaction.
17963+
17964+
Shape attributes are user-provided fields that provide extra
17965+
information at an intersection. An example of this would be a per-
17966+
vertex or per-face color on a triangle mesh.
17967+
17968+
Parameter ``name`` (str):
17969+
Name of the attribute
17970+
17971+
Parameter ``si``:
17972+
Surface interaction associated with the query
17973+
17974+
Parameter ``active`` (drjit.llvm.ad.Bool):
17975+
Mask to specify active lanes.
17976+
17977+
Returns → drjit.llvm.ad.Bool:
17978+
An unpolarized spectral power distribution or reflectance value
17979+
17980+
The default implementation throws an exception.
17981+
1795617982
.. py:method:: mitsuba.Shape.id(self)
1795717983

1795817984
Return a string identifier
@@ -18287,25 +18313,19 @@
1828718313

1828818314
.. py:method:: mitsuba.ShapePtr.eval_attribute(self, name, si, active=True)
1828918315

18290-
Evaluate a specific shape attribute at the given surface interaction.
18291-
18292-
Shape attributes are user-provided fields that provide extra
18293-
information at an intersection. An example of this would be a per-
18294-
vertex or per-face color on a triangle mesh.
18316+
Returns whether this shape contains the specified attribute.
1829518317

1829618318
Parameter ``name`` (str):
1829718319
Name of the attribute to evaluate
1829818320

1829918321
Parameter ``si`` (:py:obj:`mitsuba.SurfaceInteraction`):
18300-
Surface interaction associated with the query
18322+
*no description available*
1830118323

1830218324
Parameter ``active`` (drjit.llvm.ad.Bool):
1830318325
Mask to specify active lanes.
1830418326

1830518327
Returns → :py:obj:`mitsuba.Color3f`:
18306-
An unpolarized spectral power distribution or reflectance value
18307-
18308-
The default implementation throws an exception.
18328+
*no description available*
1830918329

1831018330
.. py:method:: mitsuba.ShapePtr.eval_attribute_1(self, name, si, active=True)
1831118331

@@ -18328,8 +18348,6 @@
1832818348
Returns → drjit.llvm.ad.Float:
1832918349
An scalar intensity or reflectance value
1833018350

18331-
The default implementation throws an exception.
18332-
1833318351
.. py:method:: mitsuba.ShapePtr.eval_attribute_3(self, name, si, active=True)
1833418352

1833518353
Trichromatic evaluation of a shape attribute at the given surface
@@ -18351,8 +18369,6 @@
1835118369
Returns → :py:obj:`mitsuba.Color3f`:
1835218370
An trichromatic intensity or reflectance value
1835318371

18354-
The default implementation throws an exception.
18355-
1835618372
.. py:method:: mitsuba.ShapePtr.eval_parameterization(self, uv, ray_flags=14, active=True)
1835718373

1835818374
Parameterize the mesh using UV values
@@ -18397,6 +18413,28 @@
1839718413
Returns → :py:obj:`mitsuba.ShapePtr`:
1839818414
*no description available*
1839918415

18416+
.. py:method:: mitsuba.ShapePtr.has_attribute(self, name, active=True)
18417+
18418+
Evaluate a specific shape attribute at the given surface interaction.
18419+
18420+
Shape attributes are user-provided fields that provide extra
18421+
information at an intersection. An example of this would be a per-
18422+
vertex or per-face color on a triangle mesh.
18423+
18424+
Parameter ``name`` (str):
18425+
Name of the attribute
18426+
18427+
Parameter ``si``:
18428+
Surface interaction associated with the query
18429+
18430+
Parameter ``active`` (drjit.llvm.ad.Bool):
18431+
Mask to specify active lanes.
18432+
18433+
Returns → drjit.llvm.ad.Bool:
18434+
An unpolarized spectral power distribution or reflectance value
18435+
18436+
The default implementation throws an exception.
18437+
1840018438
.. py:method:: mitsuba.ShapePtr.interior_medium(self)
1840118439

1840218440
Return the medium that lies on the interior of this shape
@@ -26098,6 +26136,71 @@
2609826136

2609926137
Zero-initializes the internal state associated with a parameter
2610026138

26139+
.. py:class:: mitsuba.ad.LargeSteps
26140+
26141+
Implementation of the algorithm described in the paper "Large Steps in
26142+
Inverse Rendering of Geometry" (Nicolet et al. 2021).
26143+
26144+
It consists in computing a latent variable u = (I + λL) v from the vertex
26145+
positions v, where L is the (combinatorial) Laplacian matrix of the input
26146+
mesh. Optimizing these variables instead of the vertex positions allows to
26147+
diffuse gradients on the surface, which helps fight their sparsity.
26148+
26149+
This class builds the system matrix (I + λL) for a given mesh and hyper
26150+
parameter λ, and computes its Cholesky factorization.
26151+
26152+
It can then convert vertex coordinates back and forth between their
26153+
cartesian and differential representations. Both transformations are
26154+
differentiable, meshes can therefore be optimized by using the differential
26155+
form as a latent variable.
26156+
26157+
.. py:method:: __init__()
26158+
26159+
Build the system matrix and its Cholesky factorization.
26160+
26161+
Parameter ``verts`` (``mitsuba.Float``):
26162+
Vertex coordinates of the mesh.
26163+
26164+
Parameter ``faces`` (``mitsuba.UInt``):
26165+
Face indices of the mesh.
26166+
26167+
Parameter ``lambda_`` (``float``):
26168+
The hyper parameter λ. This controls how much gradients are diffused
26169+
on the surface. this value should increase with the tesselation of
26170+
the mesh.
26171+
26172+
26173+
26174+
.. py:method:: mitsuba.ad.LargeSteps.to_differential()
26175+
26176+
Convert vertex coordinates to their differential form: u = (I + λL) v.
26177+
26178+
This method typically only needs to be called once per mesh, to obtain
26179+
the latent variable before optimization.
26180+
26181+
Parameter ``v`` (``mitsuba.Float``):
26182+
Vertex coordinates of the mesh.
26183+
26184+
Returns ``mitsuba.Float`:
26185+
Differential form of v.
26186+
26187+
.. py:method:: mitsuba.ad.LargeSteps.from_differential()
26188+
26189+
Convert differential coordinates back to their cartesian form: v = (I +
26190+
λL)⁻¹ u.
26191+
26192+
This is done by solving the linear system (I + λL) v = u using the
26193+
previously computed Cholesky factorization.
26194+
26195+
This method is typically called at each iteration of the optimization,
26196+
to update the mesh coordinates before rendering.
26197+
26198+
Parameter ``u`` (``mitsuba.Float``):
26199+
Differential form of v.
26200+
26201+
Returns ``mitsuba.Float`:
26202+
Vertex coordinates of the mesh.
26203+
2610126204
.. py:class:: mitsuba.ad.Optimizer
2610226205

2610326206
Base class of all gradient-based optimizers.
@@ -26769,6 +26872,53 @@
2676926872
Compute the Multiple Importance Sampling (MIS) weight given the densities
2677026873
of two sampling strategies according to the power heuristic.
2677126874

26875+
.. py:class:: mitsuba.ad.largesteps.SolveCholesky
26876+
26877+
DrJIT custom operator to solve a linear system using a Cholesky factorization.
26878+
26879+
.. py:method:: mitsuba.ad.largesteps.SolveCholesky.eval()
26880+
26881+
Evaluate the custom function in primal mode.
26882+
26883+
The inputs will be detached from the AD graph, and the output *must* also be
26884+
detached.
26885+
26886+
.. danger::
26887+
26888+
This method must be overriden, no default implementation provided.
26889+
26890+
Returns → object:
26891+
*no description available*
26892+
26893+
.. py:method:: mitsuba.ad.largesteps.SolveCholesky.forward()
26894+
26895+
Evaluated forward-mode derivatives.
26896+
26897+
.. danger::
26898+
26899+
This method must be overriden, no default implementation provided.
26900+
26901+
.. py:method:: mitsuba.ad.largesteps.SolveCholesky.backward()
26902+
26903+
Evaluated backward-mode derivatives.
26904+
26905+
.. danger::
26906+
26907+
This method must be overriden, no default implementation provided.
26908+
26909+
.. py:method:: mitsuba.ad.largesteps.SolveCholesky.name()
26910+
26911+
Return a descriptive name of the ``CustomOp`` instance.
26912+
26913+
The name returned by this method is used in the GraphViz output.
26914+
26915+
If not overriden, this method returns ``"CustomOp[unnamed]"``.
26916+
26917+
.. py:function:: mitsuba.ad.largesteps.mesh_laplacian()
26918+
26919+
Compute the index and data arrays of the (combinatorial) Laplacian matrix of
26920+
a given mesh.
26921+
2677226922
.. py:function:: mitsuba.ad.reparameterize_ray(scene, rng, params, ray, num_rays=4, kappa=100000.0, exponent=3.0, antithetic=False, unroll=False, active=True)
2677326923

2677426924
Reparameterize given ray by "attaching" the derivatives of its direction to
@@ -29955,6 +30105,14 @@
2995530105
Returns → str:
2995630106
*no description available*
2995730107

30108+
.. py:function:: mitsuba.variant_context()
30109+
30110+
Temporarily override the active variant. Arguments are interpreted as
30111+
they are in :func:`mitsuba.set_variant`.
30112+
30113+
Returns → None:
30114+
*no description available*
30115+
2995830116
.. py:function:: mitsuba.variants()
2995930117

2996030118
Return a list of all variants that have been compiled

0 commit comments

Comments
 (0)