Papers
Topics
Authors
Recent
Search
2000 character limit reached

DiffBMP: Bitmap Primitive Rendering

Updated 5 July 2026
  • DiffBMP is a differentiable rendering framework that treats arbitrary 2D bitmap primitives as the basis for optimized image composition.
  • It employs a custom CUDA tile-and-bin pipeline to efficiently compute gradients and scale optimization over thousands of raster elements.
  • The system integrates soft rasterization and structure-aware initialization to enhance both static image and video inverse graphics performance.

DiffBMP is a differentiable rendering framework for scenes composed of arbitrary 2D bitmap primitives—raster assets such as fingerprints, logos, flowers, textures, or handwritten marks—rather than vector shapes. In the named arXiv work, the term denotes Differentiable Rendering with Bitmap Primitives”, a scalable rendering engine that makes the position, rotation, scale, color, and opacity of bitmap elements differentiable and optimizable. The system is positioned as the bitmap-primitive counterpart to vector-focused differentiable renderers, with a custom CUDA implementation intended to support optimization over thousands of raster elements on consumer GPUs (Hong et al., 26 Feb 2026).

1. Definition and representational scope

DiffBMP addresses a limitation identified in prior differentiable rendering practice: most differentiable 2D renderers have focused on vector primitives, whereas “most images in the world are bitmaps.” The framework therefore treats arbitrary raster cutouts as the atomic primitives of a scene rather than attempting vectorization of real-world assets. The paper characterizes this as the first general-purpose, scalable differentiable renderer for arbitrary 2D bitmap images used as primitives, and argues that bitmap primitives impose distinct computational burdens because they are discrete, high-dimensional arrays rather than analytic shapes (Hong et al., 26 Feb 2026).

A DiffBMP scene is represented as a set of NN bitmap primitives. For primitive ii, the learnable parameters are the center position (xi,yi)(x_i,y_i), scale sis_i, rotation θi\theta_i, opacity logit νi\nu_i, and RGB color logit ciR3c_i\in\mathbb{R}^3. Each primitive also carries a fixed bitmap template PiP_i of spatial size (Hi,Wi)(H_i,W_i). Rendering proceeds by spatially transforming each primitive onto the canvas, sampling its bitmap values by bilinear interpolation, modulating them by learnable opacity and color, and compositing all primitives front-to-back.

This scope is important because it makes the framework suitable for assemblage-style inverse graphics with real raster assets. The paper’s examples include fingerprints, autographs, logos, flowers, and foreground video elements, which indicates that DiffBMP is intended less as a specialized benchmarking renderer than as a general bitmap composition system.

2. Forward rendering model

The forward model maps each canvas pixel (x,y)(x,y) into the normalized local coordinates of primitive ii0 through a rotation-and-scale transform: ii1 These local coordinates are then mapped to bitmap coordinates

ii2

Because ii3 is generally non-integer, DiffBMP samples the primitive by bilinear interpolation. If ii4, ii5, ii6, and ii7, then the bilinear weights are

ii8

with sampled template values

ii9

and interpolated contribution

(xi,yi)(x_i,y_i)0

Opacity is defined per pixel as

(xi,yi)(x_i,y_i)1

where (xi,yi)(x_i,y_i)2 is sigmoid. Front-to-back Porter-Duff “over” compositing is then expressed through the transmittance

(xi,yi)(x_i,y_i)3

and the final image

(xi,yi)(x_i,y_i)4

The alpha image is

(xi,yi)(x_i,y_i)5

The framework also supports an optional color-preservation formulation in which the effective primitive color blends a fixed original color (xi,yi)(x_i,y_i)6 and a learnable variation (xi,yi)(x_i,y_i)7: (xi,yi)(x_i,y_i)8 with (xi,yi)(x_i,y_i)9. According to the paper, this is used, for example, in the logo-based Marilyn Monroe assemblage (Hong et al., 26 Feb 2026).

3. Differentiability, objective functions, and optimization aids

DiffBMP is differentiable because every stage of the pipeline is differentiable: the affine coordinate transform, bilinear sampling, sigmoid parameterization of opacity and color, and alpha compositing. The paper emphasizes that the backward pass is not an approximate visibility surrogate, but an exact chain-rule gradient through raster sampling and compositing. For example, the derivative with respect to a primitive’s sis_i0 coordinate is written as

sis_i1

The paper also provides explicit expressions for color and alpha gradients, including the dependence of a primitive’s opacity on downstream transmittance terms.

The global optimization problem is cast as

sis_i2

where sis_i3 contains all primitive parameters and sis_i4 is the differentiable renderer. The paper mainly uses pixel reconstruction objectives, especially MSE/PSNR-oriented losses. For spatially constrained rendering it defines

sis_i5

with the target condition

sis_i6

This loss restricts RGB reconstruction to the target foreground while separately supervising the rendered alpha matte.

Three optimization aids are central. First, soft rasterization via Gaussian blur is applied to primitives before optimization. The implementation details specify do_gaussian_blur = true and blur_sigma = 1.0. The stated purpose is to enrich spatial gradients, because without blur bilinear interpolation yields meaningful position gradients mainly near primitive edges. Second, structure-aware initialization allocates primitives according to image structure. Local variance is computed over RGB channels with a sis_i7 sliding window, normalized to sis_i8, and primitive centers are sampled with probability

sis_i9

Scale is then initialized by

θi\theta_i0

so high-variance regions receive smaller primitives and low-variance regions larger ones. Colors are initialized near the target,

θi\theta_i1

rotation uses

θi\theta_i2

and opacity is initialized to a low but nonzero value. The main text states θi\theta_i3, while the supplementary common hyperparameters list v_init_bias=-4.0, so the exact initialization varies across configurations. Third, noisy canvas blending renders the foreground over a random background

θi\theta_i4

which prevents the optimizer from leaving target-colored regions uncovered merely because they match the static canvas color (Hong et al., 26 Feb 2026).

4. CUDA system design and computational scaling

A major contribution of DiffBMP is its custom tile-and-bin CUDA rendering pipeline, adapted from tile-based differentiable splatting ideas to 2D bitmap primitives. The image plane is partitioned into θi\theta_i5 tiles, with default tile size θi\theta_i6. On the CPU, each primitive is assigned to every tile whose bounding box it overlaps, with small padding. On the GPU, one CUDA thread block is launched per tile, with θi\theta_i7 threads per block and one thread per pixel in the tile. Threads cooperatively stage primitive parameters in shared memory and composite tile-local primitive lists in front-to-back order.

The paper presents this as the key scalability mechanism. A naive implementation has complexity θi\theta_i8, whereas the tiled renderer behaves as θi\theta_i9, where νi\nu_i0 is the average number of primitives affecting a tile or pixel after culling. The supplementary comparison states the naive PyTorch implementation has memory per iteration νi\nu_i1, while the CUDA implementation reduces this to νi\nu_i2.

The backward kernel mirrors the forward structure and uses packed __half2 atomic accumulation for parameter pairs νi\nu_i3, νi\nu_i4, νi\nu_i5, and νi\nu_i6. The paper reports that plain __half atomicAdd hurt accuracy, __half atomicCAS restored accuracy but was too slow, and packed __half2 atomicAdd preserved accuracy while improving throughput and reducing memory traffic. The implementation uses FP16 or mixed precision for texture fetches, temporaries, and several arithmetic paths.

The reported runtime and memory figures are correspondingly large. At νi\nu_i7 resolution on an RTX 3090, the naive PyTorch baseline requires 1360 ms forward, 2337 ms backward, and 6.4 GB VRAM, whereas CUDA-16bit requires 2.3 ms forward, 6.2 ms backward, and 1.1 GB VRAM. At νi\nu_i8, CUDA-16bit reports 4.3 ms forward, 5.5 ms backward, and 1.6 GB VRAM. At νi\nu_i9, CUDA-16bit reports 9.0 ms forward, 6.4 ms backward, and 3.8 GB VRAM. The supplementary summary describes the CUDA renderer as roughly 30–50× faster than the naive PyTorch baseline, and the abstract states that the system can optimize the attributes of thousands of bitmap primitives “all in under 1 min using a consumer GPU” (Hong et al., 26 Feb 2026).

5. Task-specific extensions and workflow integration

DiffBMP is extended beyond static image fitting in several ways. For videos, the system uses sequential frame optimization with warm starts,

ciR3c_i\in\mathbb{R}^30

so each frame is initialized from the optimized parameters of the previous frame. The paper then introduces two heuristics to improve temporal behavior. A primitive is marked “stuck” if it satisfies a large-scale threshold

ciR3c_i\in\mathbb{R}^31

a high-opacity threshold

ciR3c_i\in\mathbb{R}^32

and a front-depth criterion based on percentile ciR3c_i\in\mathbb{R}^33 in its spatial region. Per region, the top-ciR3c_i\in\mathbb{R}^34 stuck primitives are selected by

ciR3c_i\in\mathbb{R}^35

and their opacity logits are decayed by

ciR3c_i\in\mathbb{R}^36

Typical hyperparameters are ciR3c_i\in\mathbb{R}^37, ciR3c_i\in\mathbb{R}^38, ciR3c_i\in\mathbb{R}^39, PiP_i0, PiP_i1, and PiP_i2 or PiP_i3, depending on the experiment. A second heuristic freezes primitives in unchanged regions by computing

PiP_i4

and freezing any primitive whose bounding box PiP_i5 does not intersect the support of PiP_i6: PiP_i7

For spatially constrained rendering, low-opacity primitives are not permanently discarded but re-initialized when PiP_i8, typically 0.3, every prune_iterations, typically 50, outside warmup and optional final phases. The paper states that this preserves primitive budget for downstream editing while improving coverage of constrained foreground shapes.

The framework also includes a separate PSD export kernel. Because optimization kernels rely on atomics and are therefore unsuitable for isolated editable layers, DiffBMP exports each primitive into its own cropped layer using a primitive-level parallel kernel. The paper explicitly highlights low-resolution optimization followed by high-resolution export, including PiP_i9 or (Hi,Wi)(H_i,W_i)0 PSD export, and describes Photoshop and After Effects as target editing environments. It also states that the system is publicly accessible through an easy-to-hack Python package (Hong et al., 26 Feb 2026).

6. Empirical behavior, applications, and limitations

The paper compares DiffBMP conceptually and experimentally against DiffVG. Using 2000 primitives at 512 px and 100 iterations, the reported results are: for a simple SVG target, DiffVG achieves 24.26 dB in 67 s and DiffBMP 25.04 dB in 51 s; for a complex SVG target, DiffVG achieves 14.35 dB in 477 s and DiffBMP 23.35 dB in 115 s; for a bitmap primitive target, DiffVG is listed as N/A and DiffBMP achieves 24.26 dB in 36 s. The stated interpretation is that DiffBMP is not only applicable to bitmaps, but more robust when primitive complexity becomes large (Hong et al., 26 Feb 2026).

Ablations support the optimization design. For soft rasterization and structure-aware initialization, the reported PSNRs are 24.4/20.6/25.9 with both off, 24.7/21.5/26.5 with blur on only, 25.5/21.0/27.1 with structure-aware initialization only, and 25.7/21.7/27.4 with both on. Primitive count scaling from 1000 to 4000 improves PSNR from 22.5 dB to 25.4 dB on a portrait-like example, from 19.6 dB to 21.3 dB on a natural scene example, and from 15.4 dB to 17.8 dB on a poster-like example. For dynamic video, the combined warm-start, stuck-removal, and freeze-unchanged configuration yields PSNR 24.38, SSIM 0.630, tLP 3.49, and tOF 1.84, while warm start plus stuck removal gives the best fidelity at PSNR 24.66 and SSIM 0.647.

The demonstrated applications are correspondingly broad. The paper includes Seurat-like compositions using thousands of fingerprints and autographs, a Marilyn Monroe portrait assembled from 300 logos while preserving intrinsic logo colors, spatially constrained flower and foreground compositions, sequential video optimization, and CLIP-guided text-based creation. For the CLIP-based experiments it reports 500–1000 primitives, (Hi,Wi)(H_i,W_i)1 optimization resolution, 500 iterations, 16 augmentations, ViT-B/32 CLIP, and a negative prompt “blurry” with weight 0.1.

Several limitations are also explicit. DiffBMP fundamentally depends on GPU/CUDA because of the memory and computation demands of bitmap primitives. Performance is sensitive to hyperparameters such as initialization, primitive library, blur settings, opacity bounds, learning-rate gains, and background treatment, and local minima remain a concern. The paper also notes the absence of automatic hyperparameter selection, video-specific failure modes requiring heuristics, and the expectation that extension to 3D bitmap primitives would be substantially harder. A plausible implication is that DiffBMP is best understood as a practical inverse-graphics and creative optimization system for raster assets rather than a turnkey renderer with architecture-agnostic defaults.

Definition Search Book Streamline Icon: https://streamlinehq.com
References (1)

Topic to Video (Beta)

No one has generated a video about this topic yet.

Whiteboard

No one has generated a whiteboard explanation for this topic yet.

Follow Topic

Get notified by email when new papers are published related to DiffBMP.