hn.today

Show HN: Zpup – Zdog style 3D scenes in JSON, SVG from any angle

github.com15 points0 comments
Screenshot of Show HN: Zpup – Zdog style 3D scenes in JSON, SVG from any angle

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.

Read on github.com0 comments on Hacker News

Summary generated by AI from the linked article. hn.today is not affiliated with Hacker News or Y Combinator.

More in Programming

GIMP now has UI tests

GIMP now has UI tests

GIMP has introduced automated UI tests that launch the real application and check common tasks, from opening dialogs to exporting images. The tests run in a hidden desktop on CI servers and use accessibility data, also helping improve screen-reader support. (gimp.org)

PostgreSQL 19

PostgreSQL 19

PostgreSQL 19 adds online table repacking, query-planning advice, faster database operations, and expanded logical replication and standby consistency features. Upgrading requires a migration step, and compatibility changes include removing RADIUS support and enforcing standard-conforming strings. (postgresql.org)

The daily digest

Today's best Hacker News stories, summarized and screenshotted, one email a day.