Skip to content

Commit

Permalink
Release code
Browse files Browse the repository at this point in the history
  • Loading branch information
mworchel committed Aug 6, 2023
1 parent ec99a55 commit 4970326
Show file tree
Hide file tree
Showing 27 changed files with 45,718 additions and 4 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
*.pyc
/build
/diffshadow.egg-info
1,007 changes: 1,007 additions & 0 deletions 1_getting_started.ipynb

Large diffs are not rendered by default.

1,388 changes: 1,388 additions & 0 deletions 2_shadow_art.ipynb

Large diffs are not rendered by default.

309 changes: 309 additions & 0 deletions 3_minimal_plane.ipynb

Large diffs are not rendered by default.

616 changes: 616 additions & 0 deletions 4_low_level_primitives.ipynb

Large diffs are not rendered by default.

64 changes: 60 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
#

<p align="center">

<h1 align="center"><a href="https://mworchel.github.io/differentiable-shadow-mapping">Differentiable Shadow Mapping for Efficient Inverse Graphics</a></h1>
Expand All @@ -15,6 +13,64 @@
·
<a href="https://www.cg.tu-berlin.de/team/prof-dr-marc-alexa/"><strong>Marc Alexa</strong></a>
</p>

<h3 align="center">coming soon</h3>
</p>

## About

This repository contains the official implementation of the paper "Differentiable Shadow Mapping for Efficient Inverse Graphics", which presents a technique for efficient shadow rendering in the context of differentiable rasterization.
The implementation is based on the differentiable rasterization primitives from [nvdiffrast](https://github.com/NVlabs/nvdiffrast).

Similar to nvdiffrast, we provide a set of flexible low-level primitives for differentiable shadow mapping. These primitives are meant to be used when implementing a custom differentiable renderer with shadow mapping. They are contained in the module `diffshadow.shadow`:
- `render_shadow_map`: Render the scene(s) from the point-of-view of the light(s) and generate a shadow map with the necessary information (e.g. the depth for standard shadow mapping)
- `filter_shadow_map`: Apply the anti-aliasing operation of nvdiffrast and convolve the shadow map(s) with a filter kernel
- `compute_visibility`: From the (filtered) shadow map(s) compute the visibility for an array of points in the scene

In addition, we provide a simple renderer that implements a high-level interface to our shadow mapping primitives. A variant of this renderer has been used to generate the results in the paper. The package `diffshadow.simple_renderer` contains the renderer and utilities for scene generation and geometry processing.

## Getting Started

Setup the environment and install basic requirements using conda

```bash
conda env create -f environment.yml
conda activate diffshadow
```

In the directory where you have cloned this repository to, install our package by running

```bash
pip install .
```

Now, you can run any of the notebooks provided in this repository:
- `1_getting_started.ipynb`: Introduction to the simple renderer and its scene representation with a basic shadow-driven pose optimization
- `2_shadow_art.ipynb`: Simple shadow art experiments
- `3_minimal_plane.ipynb`: Reproduction of Figure 5 in the paper (necessity for applying anti-aliasing to the shadow map)
- `4_low_level_primitives.ipynb`: Examples for how to use the low-level shadow mapping primitives



Alternatively, if you want to use the implementation without running any notebooks, you might install our package by simply running

```bash
pip install git+https://github.com/mworchel/differentiable-shadow-mapping
```

## Common Issues

[TODO]

## Citation

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

```bibtex
@InProceedings{worchel:2023:diff_shadow_mapping,
author = {Worchel, Markus and Alexa, Marc},
title = {Differentiable Shadow Mapping for Efficient Inverse Graphics},
booktitle = {Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},
month = {June},
year = {2023},
pages = {142-153}
}
```
Loading

0 comments on commit 4970326

Please sign in to comment.