Optimizing Anamorphic Sculptures
Recorded: Sept. 14, 2026, 2:09 p.m.
| Original | Summarized |
Thiago Cardoso :: Optimizing anamorphic sculptures Thiago Cardoso About Blog Publications GitHub Optimizing anamorphic sculptures 2026-09-07 A pig made of cars, pigs and pigeons. At my workplace there’s an anamorphic sculpture that reveals a recognizable image only when viewed from a specific vantage point. The work of Jonty Hurwitz Blue Singularity from Jonty Hurwitz The sculpture as seen by the vantage point. Blue Singularity from Jonty Hurwitz My office’s sculpture always gets me thinking about how I would optimize for that kind of result. To experiment with that, I wrote an application that, given a set of 3d meshes, arrange them in the 3d space so that a target silhouette is rendered from a specific camera angle. There should have been a video here but your browser does not seem A pig made of cars, pigs and pigeons. Random meshes in, a silhouette out Overview of the optimization process. Meshes are placed at random, the silhouette is rendered and compared to the target image. Although the process has few steps, the implementation is not simple. There are multiple implementation details necessary to generate visually interesting images. First and most important, to be able to backpropagate errors from the loss to the input, the rendering step should be differentiable. The loss function should also be tuned to value details. In other words, just getting most of the image right is not enough to get a similar silhouette. Experiment with different \(\sigma\) values Interactive figure — requires JavaScript. As you can see, different \(\sigma\) values have different trade-offs. With a small \(\sigma\), errors are only propagated close to the triangle edge. Meshes placed far away won’t be moved. Having a large \(\sigma\) will make the silhouette more diffuse. The adopted solution was to anneal \(\sigma\): start large and shrink it as the optimization progresses. A large \(\sigma\) is the renderer squinting. The silhouette is a blur, but a mesh far from where it should be still feels a pull. Shrinking \(\sigma\) opens the renderer’s eyes and sharpens the edges. The intersection between the computed silhouette and the target (comparison). Comparing silhouettes $$IoU = \dfrac{|\alpha \cap t |}{|\alpha \cup t|}$$ $$\text{spill} = c \cdot \frac{1}{|F|}\sum_i \alpha_i (1 - t_i)$$Improving the outline $$\operatorname{TV}(\alpha) = \sum_{i,j} \sqrt{(\partial_x \alpha)^2 + (\partial_y \alpha)^2 + \epsilon}$$ $$\text{outline} = \dfrac{TV(\alpha)}{TV(t)}$$Penalizing collisions There should have been a video here but your browser does not seem One sculpture with a friendly dog viewpoint and a rabbit assembled from the same components. In this case, there is an additional restriction. Objects inside the intersection of the two camera frustums are visible from both vantage points, so both target images have to agree on what is painted there. Where they disagree, one of the views ends up with components it never asked for. There should have been a video here but your browser does not seem Another pig, this time made only of pigeons. From any other angle it is a flock going nowhere. There are still things to explore: rendering with more components, making the result hold up at angles near the vantage point, and using complementary views better. This is not the first time I used gradient descent for art. I did the same for abstract machine learning art See also 2026-07-09 2026-07-09 2026-03-27 2026-02-21 2024-07-07 ← All posts © 2026 Thiago Cardoso GitHub X Google Scholar RSS |
Thiago Cardoso explores the optimization of anamorphic sculptures, working to generate 3D arrangements of meshes that yield a desired silhouette when viewed from a specific vantage point. This work builds upon techniques used in art, such as catoptric and oblique anamorphosis, by applying computational methods to ensure the resulting sculptures are optimized and manufacturable. The core of the optimization process involves arranging a set of 3D meshes in space to match a target silhouette from a specified camera angle. This is achieved using gradient descent, where the positions, rotations, and scales of the meshes are iteratively adjusted to minimize a computed loss function. Initially, meshes are placed randomly, a silhouette is rendered, and the resulting image is compared to the target image to determine the error. This error is then backpropagated through the rendering process to adjust the input parameters. A significant technical challenge in this process is making the rendering step differentiable, as traditional rasterizers operate on a binary logic (pixel inside or outside the triangle) and lack gradients. To enable error backpropagation, the approach employs soft rasterizers, inspired by work on soft rasterizers, which replace the binary result with a sigmoid function of the signed squared distance from a pixel center to the triangle's boundary. The parameter sigma controls the transition sharpness; a large sigma results in a diffuse silhouette, while a smaller sigma sharpens the edges. Cardoso found that annealing sigma, starting large and reducing it during optimization, effectively sharpened the rendered edges. Further efficiency optimizations included splitting meshes into bins and recomputing gradients during backpropagation. The overall loss function is designed to address several criteria simultaneously: silhouette comparison, spill, outline quality, and object collisions. The comparison component utilizes the Intersection over Union (IoU) metric, where minimizing (1 minus IoU) ensures the rendered silhouette aligns with the target. A secondary component penalizes "spill," which measures the area of painted pixels outside the target silhouette, weighted by a factor $c$. To address jagged edges, the outline component incorporates the Total Variation (TV) metric, which quantifies the sharpness of the image changes, penalizing perimeters that are less smooth than the target, calculated as the ratio of the rendered image's TV to the target's TV, weighted by $s$. The final component addresses physical constraints by penalizing collisions between objects, where overlap is assessed using axis-aligned bounding boxes (AABB) and penetration distances relative to the frame width, weighted by $w$. The complete loss formula combines these elements: L equals the comparison loss, the spill penalty, the outline penalty, and the collision penalty. This comprehensive loss function is multiplied by specific weights to fine-tune the trade-offs between silhouette accuracy, edge fidelity, and geometric feasibility. Furthermore, the optimization process allows for exploring multiple views by generating different images for various camera angles using the same set of objects. To maximize image freedom when combining views, Cardoso utilized two cameras separated by a ninety-degree angle and combined their respective losses using the harmonic mean, which pulls the resulting optimization toward the more restrictive constraint. The research suggests that while optimizing for a single view, the generated structure possesses the potential to be assembled into various configurations, highlighting the inherent flexibility of the optimization process. |