Zpup is a JavaScript library for describing small 3D illustrations as plain JSON-like scene trees and rendering them as static SVG from any viewing angle. Inspired by Zdog, it targets icons, mascots, props, and small buildings rather than full 3D modeling. Scenes can combine flat shapes with boxes, cylinders, cones, and hemispheres; transforms apply through groups, and a single color on a solid is automatically shaded by face direction. Optional soft shading adds gradients to round forms and thick strokes. Because rendering produces an SVG string without requiring a DOM, it works in browsers and on servers, and the SVG itself needs no JavaScript to display.
Its main distinction from Zdog is how it handles occlusion: instead of sorting each shape by one representative point, Zpup compares overlapping shapes to determine which is in front. A benchmark reports a lower median proportion of incorrectly ordered pixels than Zdog - 0.3-0.4% versus 2.9-4.2% - which helps scenes remain coherent as the view turns. The project includes a browser playground and validation errors that identify invalid options and likely mistakes. It is early-stage, with a tested scene tree, transforms, orthographic projection, depth sorting, and SVG renderer, but no canvas renderer, general animation, text, clipping, perspective, or textures. Shapes that deeply intersect can also render incorrectly, so complex scenes call for a full 3D engine.
Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.