Giter Site home page Giter Site logo

mworchel / differentiable-rendering-parametric Goto Github PK

View Code? Open in Web Editor NEW
26.0 8.0 2.0 20.63 MB

Differentiable Rendering of Parametric Geometry (SIGGRAPH Asia 2023)

License: BSD 3-Clause "New" or "Revised" License

Jupyter Notebook 13.34% Python 86.66%
3d-reconstruction computer-aided-design computer-graphics computer-vision deep-learning differentiable-rendering inverse-graphics inverse-rendering machine-learning parametric-surface pytorch rendering shape-modeling

differentiable-rendering-parametric's Introduction

ACM Transactions on Graphics (SIGGRAPH Asia 2023)
Markus Worchel · Marc Alexa

About

This repository contains the official implementation of the paper "Differentiable Rendering of Parametric Geometry", which proposes techniques for robust differentiable rendering of parametric spline geometry. The implementation is based on PyTorch and is provided as installable package drpg. The following modules may be of primary interest to most users:

  • bezier_curve.py, bezier_surface.py, casteljau.py: routines for differentiable Bézier curve/surface evaluation and subdivision
  • tessellation.py: routines for uniform and adaptive differentiable tessellation
  • regularization.py: routines for regularization (C1/G1 losses) and gradient preconditioning

Getting Started

Setup the environment and install the required packages using conda

conda env create -f environment.yml
conda activate drpg

Install our package by running the following command in the repository directory

pip install .

Now you can explore and run the notebooks and scripts provided in this repository.

General Framework

The data structures and tessellation routines are briefly introduced in the notebooks

  • 1_data_structures.ipynb
  • 2_tessellation.ipynb

Multi-View Reconstruction

Multi-view reconstruction experiments can be run using the script

  • 3_multiview_reconstruction.py

On a high level, the script accepts a mesh that is used to generate the (artificial) multi-view inputs. It then performs the 3D reconstruction. Please keep in mind that the script is not designed to load actual real world image data. The reconstruction for the bottom left object in Figure 19 can be reproduced by running

python 3_multiview_reconstruction.py configs/abc_1.json --viewer

The flag --viewer will launch an interactive 3D viewer that shows the optimization in real time. After the optimization has finished, you will need to close the viewer window manually. The results are located in out/multiview/abc_1, including a tessellation of the reconstructed spline surface (optimized.obj) and its control mesh (control_mesh.npz).

The reconstruction of Spot in Figure 21 can be reproduced by running

python 3_multiview_reconstruction.py configs/spot.json --viewer

Caustics Lens Design

The experiments for lens design with caustics images can be run using the script

  • 4_caustics_design.py

The script accepts a target caustics image and will optimize a lens, represented by a NURBS surface, such that the lens will reproduce the target caustics under illumination. The results for the bear cub in Figure 22 (last row, middle) can be reproduced by running

python 4_caustics_design.py data/bear.png out/caustics/bear --viewer

The results will be located in out/caustics/bear and include a rendering of the final caustics image (rendering.png), the control points of the NURBS surface (control_points.npy), and a tessellated version of the lens (optimized.obj + slab.ply)

Silhouette Reconstruction with Curves

Reconstruction of parametric curves from silhouette images is shown in the notebook

  • 5_silhouette_curve.ipynb

License and Copyright

The code in this repository is provided under a 3-clause BSD license.

The following functions/classes are based on the code for Large Steps in Inverse Rendering of Geometry (3-clause BSD): drpg.regularization.compute_lsig_matrix, drpg.regularization.laplacian_uniform_all, and drpg.rendering.SphericalHarmonics.

The black and white bear cub painting has been created for this publication and is released to the public domain (CC0). The copyright of the ABC objects is owned by their creators, see the ABC dataset for details. Spot by Keenan Crane (CC0). Kloppenheim 06 HDRI by polyhaven (CC0).

Citation

If you find this code or our method useful for your academic research, please cite our paper

@article{worchel:2023:drpg,
  author = {Worchel, Markus and Alexa, Marc},
  title = {Differentiable Rendering of Parametric Geometry},
  journal = {ACM Trans. Graph.},
  year = {2023},
  month = {dec},
  volume = {42},
  number = {6},
  url = {https://doi.org/10.1145/3618387},
  doi = {10.1145/3618387},
}

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.