Skip to content

Commit

Permalink
Fix Mesh update log message
Browse files Browse the repository at this point in the history
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
  • Loading branch information
njroussel authored and denghilbert committed Jul 25, 2023
1 parent c99acb7 commit a9bedb3
Show file tree
Hide file tree
Showing 19 changed files with 2,672 additions and 815 deletions.
8 changes: 8 additions & 0 deletions docs/docs_api/list_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -540,6 +540,8 @@

.. autoclass:: mitsuba.ad.Adam

.. autoclass:: mitsuba.ad.LargeSteps

.. autoclass:: mitsuba.ad.Optimizer

.. autoclass:: mitsuba.ad.SGD
Expand All @@ -550,6 +552,10 @@

.. autofunction:: mitsuba.ad.common.mis_weight

.. autoclass:: mitsuba.ad.largesteps.SolveCholesky

.. autofunction:: mitsuba.ad.largesteps.mesh_laplacian

.. autofunction:: mitsuba.ad.reparameterize_ray

.. autofunction:: mitsuba.chi2.BSDFAdapter
Expand Down Expand Up @@ -824,6 +830,8 @@

.. autofunction:: mitsuba.variant

.. autofunction:: mitsuba.variant_context

.. autofunction:: mitsuba.variants

.. autofunction:: mitsuba.warp.beckmann_to_square
Expand Down
216 changes: 187 additions & 29 deletions docs/generated/extracted_rst_api.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4297,6 +4297,13 @@
Returns → bool:
*no description available*

.. py:method:: mitsuba.Emitter.sampling_weight(self)

The emitter's sampling weight.

Returns → float:
*no description available*

.. py:class:: mitsuba.EmitterFlags

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

.. py:method:: mitsuba.EmitterPtr.sampling_weight(self)

The emitter's sampling weight.

Returns → drjit.llvm.ad.Float:
*no description available*

.. py:method:: mitsuba.EmitterPtr.select_(arg0, arg1, arg2)

Parameter ``arg0`` (drjit.llvm.ad.Bool):
Expand Down Expand Up @@ -10668,19 +10682,19 @@

.. py:data:: mitsuba.MI_VERSION
:type: str
:value: 3.2.1
:value: 3.3.0

.. py:data:: mitsuba.MI_VERSION_MAJOR
:type: int
:value: 3

.. py:data:: mitsuba.MI_VERSION_MINOR
:type: int
:value: 2
:value: 3

.. py:data:: mitsuba.MI_VERSION_PATCH
:type: int
:value: 1
:value: 0

.. py:data:: mitsuba.MI_YEAR
:type: str
Expand Down Expand Up @@ -17860,25 +17874,19 @@

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

Evaluate a specific shape attribute at the given surface interaction.

Shape attributes are user-provided fields that provide extra
information at an intersection. An example of this would be a per-
vertex or per-face color on a triangle mesh.
Returns whether this shape contains the specified attribute.

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

Parameter ``si`` (:py:obj:`mitsuba.SurfaceInteraction`):
Surface interaction associated with the query
*no description available*

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

Returns → :py:obj:`mitsuba.Color3f`:
An unpolarized spectral power distribution or reflectance value

The default implementation throws an exception.
*no description available*

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

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

The default implementation throws an exception.

.. py:method:: mitsuba.Shape.eval_attribute_3(self, name, si, active=True)

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

The default implementation throws an exception.

.. py:method:: mitsuba.Shape.eval_parameterization(self, uv, ray_flags=14, active=True)

Parameterize the mesh using UV values
Expand Down Expand Up @@ -17953,6 +17957,28 @@
Returns → :py:obj:`mitsuba.Medium`:
*no description available*

.. py:method:: mitsuba.Shape.has_attribute(self, name, active=True)

Evaluate a specific shape attribute at the given surface interaction.

Shape attributes are user-provided fields that provide extra
information at an intersection. An example of this would be a per-
vertex or per-face color on a triangle mesh.

Parameter ``name`` (str):
Name of the attribute

Parameter ``si``:
Surface interaction associated with the query

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

Returns → drjit.llvm.ad.Bool:
An unpolarized spectral power distribution or reflectance value

The default implementation throws an exception.

.. py:method:: mitsuba.Shape.id(self)

Return a string identifier
Expand Down Expand Up @@ -18287,25 +18313,19 @@

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

Evaluate a specific shape attribute at the given surface interaction.

Shape attributes are user-provided fields that provide extra
information at an intersection. An example of this would be a per-
vertex or per-face color on a triangle mesh.
Returns whether this shape contains the specified attribute.

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

Parameter ``si`` (:py:obj:`mitsuba.SurfaceInteraction`):
Surface interaction associated with the query
*no description available*

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

Returns → :py:obj:`mitsuba.Color3f`:
An unpolarized spectral power distribution or reflectance value

The default implementation throws an exception.
*no description available*

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

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

The default implementation throws an exception.

.. py:method:: mitsuba.ShapePtr.eval_attribute_3(self, name, si, active=True)

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

The default implementation throws an exception.

.. py:method:: mitsuba.ShapePtr.eval_parameterization(self, uv, ray_flags=14, active=True)

Parameterize the mesh using UV values
Expand Down Expand Up @@ -18397,6 +18413,28 @@
Returns → :py:obj:`mitsuba.ShapePtr`:
*no description available*

.. py:method:: mitsuba.ShapePtr.has_attribute(self, name, active=True)

Evaluate a specific shape attribute at the given surface interaction.

Shape attributes are user-provided fields that provide extra
information at an intersection. An example of this would be a per-
vertex or per-face color on a triangle mesh.

Parameter ``name`` (str):
Name of the attribute

Parameter ``si``:
Surface interaction associated with the query

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

Returns → drjit.llvm.ad.Bool:
An unpolarized spectral power distribution or reflectance value

The default implementation throws an exception.

.. py:method:: mitsuba.ShapePtr.interior_medium(self)

Return the medium that lies on the interior of this shape
Expand Down Expand Up @@ -26098,6 +26136,71 @@

Zero-initializes the internal state associated with a parameter

.. py:class:: mitsuba.ad.LargeSteps

Implementation of the algorithm described in the paper "Large Steps in
Inverse Rendering of Geometry" (Nicolet et al. 2021).

It consists in computing a latent variable u = (I + λL) v from the vertex
positions v, where L is the (combinatorial) Laplacian matrix of the input
mesh. Optimizing these variables instead of the vertex positions allows to
diffuse gradients on the surface, which helps fight their sparsity.

This class builds the system matrix (I + λL) for a given mesh and hyper
parameter λ, and computes its Cholesky factorization.

It can then convert vertex coordinates back and forth between their
cartesian and differential representations. Both transformations are
differentiable, meshes can therefore be optimized by using the differential
form as a latent variable.

.. py:method:: __init__()

Build the system matrix and its Cholesky factorization.

Parameter ``verts`` (``mitsuba.Float``):
Vertex coordinates of the mesh.

Parameter ``faces`` (``mitsuba.UInt``):
Face indices of the mesh.

Parameter ``lambda_`` (``float``):
The hyper parameter λ. This controls how much gradients are diffused
on the surface. this value should increase with the tesselation of
the mesh.



.. py:method:: mitsuba.ad.LargeSteps.to_differential()

Convert vertex coordinates to their differential form: u = (I + λL) v.

This method typically only needs to be called once per mesh, to obtain
the latent variable before optimization.

Parameter ``v`` (``mitsuba.Float``):
Vertex coordinates of the mesh.

Returns ``mitsuba.Float`:
Differential form of v.

.. py:method:: mitsuba.ad.LargeSteps.from_differential()

Convert differential coordinates back to their cartesian form: v = (I +
λL)⁻¹ u.

This is done by solving the linear system (I + λL) v = u using the
previously computed Cholesky factorization.

This method is typically called at each iteration of the optimization,
to update the mesh coordinates before rendering.

Parameter ``u`` (``mitsuba.Float``):
Differential form of v.

Returns ``mitsuba.Float`:
Vertex coordinates of the mesh.

.. py:class:: mitsuba.ad.Optimizer

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

.. py:class:: mitsuba.ad.largesteps.SolveCholesky

DrJIT custom operator to solve a linear system using a Cholesky factorization.

.. py:method:: mitsuba.ad.largesteps.SolveCholesky.eval()

Evaluate the custom function in primal mode.

The inputs will be detached from the AD graph, and the output *must* also be
detached.

.. danger::

This method must be overriden, no default implementation provided.

Returns → object:
*no description available*

.. py:method:: mitsuba.ad.largesteps.SolveCholesky.forward()

Evaluated forward-mode derivatives.

.. danger::

This method must be overriden, no default implementation provided.

.. py:method:: mitsuba.ad.largesteps.SolveCholesky.backward()

Evaluated backward-mode derivatives.

.. danger::

This method must be overriden, no default implementation provided.

.. py:method:: mitsuba.ad.largesteps.SolveCholesky.name()

Return a descriptive name of the ``CustomOp`` instance.

The name returned by this method is used in the GraphViz output.

If not overriden, this method returns ``"CustomOp[unnamed]"``.

.. py:function:: mitsuba.ad.largesteps.mesh_laplacian()

Compute the index and data arrays of the (combinatorial) Laplacian matrix of
a given mesh.

.. 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)

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

.. py:function:: mitsuba.variant_context()

Temporarily override the active variant. Arguments are interpreted as
they are in :func:`mitsuba.set_variant`.

Returns → None:
*no description available*

.. py:function:: mitsuba.variants()

Return a list of all variants that have been compiled
Expand Down
Loading

0 comments on commit a9bedb3

Please sign in to comment.