All work

Python library

diffrast

diffrast is a Python library that renders 3D models in PyTorch in a way a program can learn from. Give it a model and a few pictures, and it works out how to change the model’s shape, colours or position until it matches them.

  • Role: Personal project, open source
  • Year: 2026
  • Status: In development
  • Stack: Python · PyTorch · Triton
A polished torus knot rendered by diffrast, reflecting the bright panels of a dark studio.

A torus knot rendered by diffrast.

01 / 05

Context

Tools that turn photos into 3D models, or paint textures onto them, depend on this kind of renderer. The usual one, NVIDIA’s nvdiffrast, only runs on NVIDIA cards and may not be used commercially. diffrast does the same job under the MIT licence, also runs on AMD, and uses the same function names, so existing code can switch by changing one line.

What I built

I built every step of the render: drawing the triangles, blending values across them, applying textures, smoothing the edges and rendering see-through layers. Each step works backwards too, so a program can learn from the result.

Every step has a simple version that is easy to check and a fast one written in Triton, which runs on AMD as well as NVIDIA cards; the tests make sure both give the same answers. On an AMD RX 9070 XT it renders eight views of a 100,000-triangle model, and works out how the model should change, in 13 ms.

CV — Senne Cools