DiffBMP: Differentiable Rendering with Bitmap Primitives
Organizations: INMC · IPAI · Dept. of ECE, Seoul National University, Republic of Korea
Abstract
We introduce DiffBMP, a scalable and efficient differentiable rendering engine for a collection of bitmap images. Our work addresses a limitation that traditional differentiable renderers are constrained to vector graphics, given that most images in the world are bitmaps. Our core contribution is a highly parallelized rendering pipeline, featuring a custom CUDA implementation for calculating gradients. This system can, for example, optimize the position, rotation, scale, color, and opacity of thousands of bitmap primitives all in under 1 min using a consumer GPU. We employ and validate several techniques to facilitate the optimization: soft rasterization via Gaussian blur, structure-aware initialization, noisy canvas, and specialized losses/heuristics for videos or spatially constrained images. We demonstrate DiffBMP is not just an isolated tool, but a practical one designed to integrate into creative workflows. It supports exporting compositions to a native, layered file format, and the entire framework is publicly accessible via an easy-to-hack Python package.
Figures & tables
| 2D Differentiable rendering method | Primitive type | Applications | Opacity Support | Para- llelism | Engine / Interface |
| Differentiable Composition by Reddy et al. [44] | Bitmap | Specialized for patterns e.g . , manipulation, tiling | ✗ | ✗ | Pytorch / Python |
| DiffVG [ 27 ] and its extensions [ 43 , 33 , 4 , 5 , 60 , 59 ] | Vector | Very diverse e.g . , vectorization, painterly, etc. | ✓ | ✓ | C++ / Python |
| DiffBMP (Ours) | Bitmap | Very diverse. e.g . , painterly, assemblage, video, etc. | ✓ | ✓ | CUDA / Python |
| Image res / Tile size | 512 512 / 16 16 | 1024 1024 / 16 16 | 1024 1024 / 32 32 | 2048 2048 / 32 32 | |
| PyTorch | RTX 3090 | 1360ms / 2337ms / 6.4 GB | 5514ms / 9811ms / 12.0 GB | 1393ms / 2477ms / 5.0 GB | 5405ms / 9483ms / 9.0 GB |
| L40S | 1342ms / 2413ms / 6.6 GB | 4570ms / 8151ms / 12.2 GB | 1423ms / 2507ms / 5.2 GB | 4914ms / 8707ms / 9.2 GB | |
| CUDA-32bit | RTX 3090 | 3.9ms / 11.6ms / 1.0 GB | 7.2ms / 9.7ms / 2.1 GB | 7.6ms / 9.3ms / 2.0 GB | 16.1ms / 10.0ms / 6.1 GB |
| L40S | 4.7ms / 2.9ms / 1.2 GB | 10.5ms / 2.8ms / 2.3 GB | 8.5ms / 2.9ms / 2.2 GB | 23.3ms / 3.8ms / 6.3 GB | |
| CUDA-16bit | RTX 3090 | 2.3ms / 6.2ms / 1.1 GB | 4.2ms / 5.8ms / 1.6 GB | 4.3ms / 5.5ms / 1.6 GB | 9.0ms / 6.4ms / 3.8 GB |
| L40S | 2.0ms / 2.1 ms / 1.2 GB | 5.4ms / 2.3ms / 1.8 GB | 4.5ms / 2.3ms / 1.8 GB | 12.8ms / 3.0ms / 4.0 GB | |
| SoftRas Sec. 3.2.1 | SA-Init. Sec. 3.2.2 | Scenario 1 (512 512) | Scenario 2 (512 512) | Scenario 3 (1024 1024) |
| ✗ | ✗ | 24.4 | 20.6 | 25.9 |
| ✓ | ✗ | 24.7 | 21.5 | 26.5 |
| ✗ | ✓ | 25.5 | 21.0 | 27.1 |
| ✓ | ✓ | 25.7 | 21.7 | 27.4 |
| Init. | Rem. Stk. | Freez. Unch. | Frame-wise Fidelity | Anti-flicker | ||
| PSNR | SSIM | tLP | tOF | |||
| ✗ | ✗ | ✗ | 24.19 2.36 | 0.616 0.106 | 7.41 8.89 | 2.23 1.10 |
| ✓ | ✗ | ✗ | 24.26 1.73 | 0.629 0.073 | 5.39 4.64 | 1.88 1.13 |
| ✓ | ✓ | ✗ | 24.66 2.03 | 0.647 0.088 | 4.98 4.93 | 1.89 1.11 |
| ✓ | ✗ | ✓ | 24.23 2.13 | 0.617 0.099 | 3.50 2.52 | 1.91 1.32 |
| ✓ | ✓ | ✓ | 24.38 2.23 | 0.630 0.069 | 3.49 2.26 | 1.84 1.19 |
| Category | Parameter | Value / Description |
| Initialization | (default for most; for Fig. 8) | |
| (yields initial opacity) | ||
| (color initialization noise std) | ||
| (local variance computation window) | ||
| (base sampling probability for low-variance areas) | ||
| (200 for spatially constrained cases) |
| Figure | Primitive(s) | Resolution | Scale Range | Iter. | Special Settings | |
| Figure 1: Teaser examples | ||||||
| 1(a)-fingerprint | fingerprint.jpg | 2000 | 1024 | [2, 8] | 300 | , |
| 1(a)-autograph | autograph_seurat.png | 2000 | 1024 | [2, 10] | 300 | |
| 1(b) | logos/*.png (300 logos) | 300 | 512 | [4, 20] | 100 | , grayscale L1 + MSE loss |
| 1(c)-flowers | 5 flower types | 1000 | 512 | [2, 31] | 300 | , mask, pruning |
| 1(c)-girl | 2 flower types | 1000 | 512 | [2, 20] | 300+100 | , initial+sequential (17 frames), Algorithm 2 , freeze unchanged |
| Aspect | Naive PyTorch | Our CUDA |
| Spatial culling | None | Tile-based binning |
| Primitive loop | Sequential ( ) | Parallel per-pixel |
| Memory per iteration | , | |
| Precision | FP32 only | FP16 + FP32 mixed |
| Intermediate tensors | per primitive | Small per-pixel cache |
| Atomic operations | Many (unoptimized) | Packed |
Differentiable Rendering
Differentiable rendering makes image formation and its gradients computable, enabling visual scenes and graphics to be optimized from observations.
See all 50 papers