Skip to content
Go to file

Latest commit


Git stats


Failed to load latest commit information.
Latest commit message
Commit time

Relightable Neural Renderer

Paper | Video | Supplementary Video | Data

This repository contains a pytorch implementation for the paper: A Neural Rendering Framework for Free-Viewpoint Relighting (CVPR 2020). Our work takes multi-view images of an object under an unknown illumination as input, and produces a neural representation that can be rendered for both novel viewpoint and novel lighting.



Tested on Ubuntu 16.04 + CUDA 9.0 + gcc 4.9.2 + Anaconda 3

Add CUDA to paths (modify based on your CUDA location):

export PATH=/usr/local/cuda/bin:$PATH \
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH

Install conda environment:

sudo apt install libopenexr-dev
conda env create -f environment.yml
conda activate relightable-nr

Install PyTorch Geometric:

pip --no-cache-dir install torch-scatter==1.3.2 -f
pip --no-cache-dir install torch-sparse==0.4.3 -f 
pip --no-cache-dir install torch-cluster==1.4.5 -f 
pip --no-cache-dir install torch-geometric==1.3.2 -f

Install our modified version of daniilidis-group's neural_renderer:

cd neural_renderer
python install

Data Preparation

Data Layout

An example data is provided here. After downloading, create a data/ directory under this project and extract the downloaded .zip to this directory. The final layout will look like:

    material_sphere/         # root directory for a scene
        light_probe/         # contains environment maps for lighting
        rgb0/                # images under the first lighting
        rgb1/                # (optional) images under the second lighting
        test_seq/            # viewpoint sequences for inference
            spiral_step720/  # an example sequence
        calib.mat            # camera intrinsics and extrinsics for the images in rgb0/
	mesh.obj             # proxy mesh with texture coordinates
	mesh_7500v.obj       # downsampled proxy mesh used for GCN
	tex.png              # texture image, can be just all white

For your own scenes, you need to prepare the data layout as listed above. For example, you may need to use structure-from-motion and multi-view stereo tools to generate the required camera calibration and proxy mesh.


Run the following script to generate rasterization data and initial lighting information that will be used during training:



After data preparation completes, run:


For tweaking the arguments in the script, please refer to for available options and their meaning.

During training, various logging information will be recorded to a tensorboard summary, located at [scene_dir]/logs/rnr/[experiment_name]/. Checkpoints (model*.pth), training settings (params.txt) and validation outputs (val_*/) are also saved to this directory.

Inference (Free-Viewpoint Relighting)

Two examples are included in, one for novel view synthesis (synthesizes novel views but keeps the lighting condition the same as training data) and one for free-viewpoint relighting (synthesizes images under both novel views and novel lighting). The synthesized images will be saved in [seq_dir]/resol_512/rnr/[model_id]/. Please refer to for more options during inference.

The above two examples use the viewpoint sequence determined by spiral_step720/calib.mat. To generate new viewpoint sequence, you need to create camera intrinsics and extrinsics for each frame, just like the provided calib.mat.


If you find our code or paper useful, please consider citing:

  title={A Neural Rendering Framework for Free-Viewpoint Relighting},
  author={Chen, Zhang and Chen, Anpei and Zhang, Guli and Wang, Chengyuan and Ji, Yu and Kutulakos, Kiriakos N and Yu, Jingyi},
  booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition},

Relevant Works

Deferred Neural Rendering: Image Synthesis using Neural Textures (SIGGRAPH 2019)
Justus Thies, Michael Zollhöfer, Matthias Nießner

DeepVoxels: Learning Persistent 3D Feature Embeddings (CVPR 2019)
Vincent Sitzmann, Justus Thies, Felix Heide, Matthias Nießner, Gordon Wetzstein, Michael Zollhöfer

NeRF: Representing Scenes as Neural Radiance Fields for View Synthesis (arXiv 2020)
Ben Mildenhall, Pratul P. Srinivasan, Matthew Tancik, Jonathan T. Barron, Ravi Ramamoorthi, Ren Ng

Neural Voxel Renderer: Learning an Accurate and Controllable Rendering Tool (CVPR 2020)
Konstantinos Rematas, Vittorio Ferrari

Learning Implicit Surface Light Fields (arXiv 2020)
Michael Oechsle, Michael Niemeyer, Lars Mescheder, Thilo Strauss, Andreas Geiger


A Neural Rendering Framework for Free-Viewpoint Relighting (CVPR 2020)




No releases published


No packages published
You can’t perform that action at this time.