RIVOLI reconstructs continuous BRDFs from sparse measurements. It fits expansions on radial basis functions over the product of the hemispheres of the half and difference vectors, optionally times an interval of wavelengths, regularized by their Dirichlet energy so that they stay smooth between the measurements. The models are reciprocal by construction, can be evaluated anywhere, on a GPU with NVIDIA Warp, and written as MERL files for renderers.
Features
- Kernels: Gaussian radial basis functions on the Rusinkiewicz domain, with a width per factor, for isotropic or anisotropic BRDFs, made reciprocal by summation over orbits, and spectral with a wavelength factor.
- Fitting: least squares in log space, regularized by the Dirichlet energy of the expansion, from interpolation to the smoothest fits.
- Sampling: Super-Fibonacci low-discrepancy samplings of the isotropic and anisotropic domains, above the horizon or over the fundamental domain of reciprocity.
- Geometry: half and difference vectors, Rusinkiewicz angles, geodesic and chordal distances, and spacings of samplings, from which the widths of the kernels follow.
- Colour: spectra converted to CIE XYZ and linear sRGB, under the D65 or E illuminants.
- Input and output: MERL files read and written, and measurements read from HDF5 files of any structure, described by a JSON layout.
- GPU: models evaluated, MERL files written, and Dirichlet energies computed in parallel with NVIDIA Warp, on GPUs or CPUs.
Installation
pip install rivoli
RIVOLI requires Python 3.13 or later, and depends only on NumPy. Optional features are installed with extras:
| Extra | Installs | Enables |
|---|---|---|
warp |
NVIDIA Warp | rivoli.warp and the device arguments. Enables GPU acceleration with NVIDIA GPUs. |
hdf5 |
h5py | rivoli.hdf5. Required for reading/writing HDF5 files. |
pip install "rivoli[warp,hdf5]"
Quick start
Fit a model to measurements of an isotropic BRDF, here an analytic one, then evaluate it at new sites:
import numpy as np
from rivoli.distances import nearest_neighbour_spacings
from rivoli.geometry import spherical_to_cartesian
from rivoli.model import fit
from rivoli.sampling import super_fibonacci_isotropic
def sites_of(theta_h, theta_d, phi_d):
"""Half and difference vectors of an isotropic BRDF, from Rusinkiewicz angles."""
return spherical_to_cartesian(theta_h, 0.0), spherical_to_cartesian(theta_d, phi_d)
def brdf(theta_h, theta_d, phi_d):
"""A diffuse and a glossy lobe, standing for measurements."""
return 0.2 / np.pi + 5.0 * np.cos(theta_h) ** 200
# Measurements at 5,000 well-spread sites above the horizon
angles = super_fibonacci_isotropic(5000, above_horizon=True)
sites, values = sites_of(*angles), brdf(*angles)
# 500 kernels, centred over the fundamental domain of reciprocity, narrower
# along the half vector, around the specular peak
centres = sites_of(*super_fibonacci_isotropic(500, above_horizon=True, symmetry="reciprocity"))
spacing_h, spacing_d = nearest_neighbour_spacings(*centres, metric="chordal")
widths = (0.7 * spacing_h.mean(), 12.0 * spacing_d.mean())
model = fit(
sites, values, centres, widths=widths, metric="chordal", isotropic=True, regularization=1e-5
)
# The model is continuous: evaluate it anywhere, here on new sites
test = super_fibonacci_isotropic(20000, above_horizon=True)
reconstruction = model(sites_of(*test))
print(np.linalg.norm(reconstruction - brdf(*test)) / np.linalg.norm(brdf(*test))) # 0.005
A model of three channels, such as RGB, is written as a MERL file by
rivoli.merl.write_model, and evaluated on a GPU with device="cuda:0" once the warp
extra is installed.
Examples
The examples directory holds complete scripts, run by the tests so that
they follow the API:
merl_reconstruction.pyreconstructs a BRDF of the MERL database from a few percent of its bins, and measures the error on the others.hdf5_reconstruction.pyreconstructs the colour of spectral measurements read from an HDF5 file, per wavelength, per RGB channel, or with a spectral model.
See their guide to install their dependencies and run them.
Contributing
Bug reports, questions and contributions are welcome! Whether you fix a bug, improve documentation or add features, feel free to open an issue or submit a pull request. You will find all the information you need in the contributing guide to set up a development environment. Everyone taking part in the project is expected to follow the Code of Conduct.
Contact
François Margall - fr.margall@proton.me
Citation
If you use RIVOLI in your research, please cite it with the metadata of
CITATION.cff, also available through the "Cite this repository" button
of GitHub.
Publications
- La Coupole: an SVBRDF measurement device for large and non-planar objects. Antoine Lucat, Pierre Mézières, François Margall, Louis De Oliveira, Marjorie Paillet, Arnaud Tizon, Pierre Bénard, Romain Pacanowski. Optics Express Vol. 34, Issue 7, pp. 11695-11709 (March 2026). DOI: 10.1364/OE.587877.
License
RIVOLI is distributed under the AGPL-3.0-or-later license.
This repository was using the Scientific Python Template.
Metadata
Release files for rivoli 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rivoli-0.1.0.tar.gz | 911.0 kB | With provenance | Details for rivoli-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rivoli-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for rivoli-0.1.0-py3-none-any.whl |
Total release size: 986.9 kB
Release files / rivoli-0.1.0.tar.gz
| Download URL | rivoli-0.1.0.tar.gz |
|---|---|
| Size | 911.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1520fb7b058d7e1851c62a41ea92ba7e0a71f3d0a035c6e6e5c03a73f031c1d4
|
|
BLAKE2b-256 checksum How to use checksums |
fdffd4c922256a66da2aec84d3b544ede86347f6aaffc17012796268d81914c6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logRelease files / rivoli-0.1.0-py3-none-any.whl
| Download URL | rivoli-0.1.0-py3-none-any.whl |
|---|---|
| Size | 75.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ec208dd03c381c639cc187aa98d0606892192ffc4c3df104259b219d2ea5d40e
|
|
BLAKE2b-256 checksum How to use checksums |
dc38e925f54ca22d2b6565b9a5259f624730808fdf304c3e78a3957c1d5266b8
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logSecurity for rivoli 0.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for rivoli-0.1.0.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Oct 30, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.