Code for SIGGRAPH 2025 (ToG) paper "Bernstein Bounds for Caustics"
[Paper] [Supplementary] [Video (Compressed)]
The implementation includes the precomputation end and the rendering end.
-
Precomputation: We have Python implementation for all cases, which is easy to run.
- Only single scattering case has C++ implementation (integrated in mitsuba).
- Double scattering is speeded up using Numba (
batch/
), which, unfortunately requires several minites to compile each time and we currently failed to cache the compiled file properly due to some limitations of Numba in handling complex global objects.
-
Rendering: We based on the code of specular polynomials. I copied the building instructions below:
The project is based on https://github.com/VicentChen/mitsuba. Please install the dependency first. (I provide a precompiled version for msvc at https://github.com/mollnn/mitsuba0.6-dep-py3.9.12)
cd mts1 mkdir cbuild cd cbuild cmake ..
Then build the generated project in cbuild. Tested on Windows 10, Visual Studio 2022. The implementation builds upon Mbglints and CyPolynomials.
I plan to release code for almost all figures. Unfortunately, some experiments rely on local code modifications, so putting them all together needs time.
-
Fig. 09: demonstration of how to convert position/irradiance bounds into distributions. In the directory
2d/fig09
, runrun_main_top/bottom.py
. You can choose the_latex
variant to generate the paper figure, which however needs a latex environment.- Bonus: To visualize the computation process of polynomials expressed in Bernstein basis, please try
2d/mid/run_main.py
. We show the polynomials (curves) and their control points (dots).This figure is not shown in the paper because of some formatting inconvenience. Nevertheless, I still feel it's helpful for understanding.
- Bonus: To visualize the computation process of polynomials expressed in Bernstein basis, please try
-
Fig. 10: ablation on multi-sample estimators. Please run
test/fig_plane/cmp_sample.py
. -
Fig. 13 (top): main experiment (single reflection). Please run
test/fig_plane/test.py
. -
Fig. 13 (bottom): main experiment (single refraction). Please run
test/fig_sphere/test.py
. -
Fig. 14 (top): main experiment (double refraction). Modify
batch/alias.py
according totest/fig_slab/alias.md
and then runbatch/run_mesh.py
to generate the distribution file. Finaly, runtest/fig_slab/test.py
. -
Fig. 14 (bottom): main experiment (double refraction). Modify
batch/alias.py
according totest/fig_diamond/alias.md
and then runbatch/run_mesh.py
to generate the distribution file. Finaly, runtest/fig_diamond/test.py
. -
Fig. 20: "failure" case (single refraction). Please run
test/fig_pool/test.py
.
Some scenes are modified from SMS. The implementation builds upon Mbglints and CyPolynomials. We sincerely thank the authors for kindly release their code and scenes, as well as their great works. We also include a locally modified version of https://github.com/Mira-13/figure-gen.