Skip to content

Implementations of differentiable 3D mesh renderers using Pytorch along with examples

Notifications You must be signed in to change notification settings

KaranBalakumar/pytorch_differential_mesh_renderer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Introduction

This repository contains implementations of two differentiable 3D mesh renderers using PyTorch:

mesh_render mesh_render

Setup

  1. Create a virtual environment with python3 -m venv env
  2. Activate it with source env/bin/activate
  3. Install external dependencies with pip install -r requirements.txt

Some additional setup is required to use the optimized kernel for the barycentric renderer.

Running examples

To run the examples, after activating the virtual environment.

python -m src.examples.example1b

Note

Python-only versions of these rasterizers are slow. Some basic optimizations, like vectorizing calculations and using quad trees to remove triangles outside the blur radius, can help, but the lack of parallel processing is a big issue, especially as the screen size increases. Rebuilding the computation graph and running backpropagation also takes up a lot of resources. In production, developers often manually calculate the forward and backward passes to avoid the extra overhead of auto-grad, though this can make the code harder to understand. To improve performance, many use C++ (which offers better parallelism with threads and more control over memory) or CUDA (which uses the GPU to speed up rasterization).

About

Implementations of differentiable 3D mesh renderers using Pytorch along with examples

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published