HeadlinesBriefing favicon HeadlinesBriefing.com

PolyCSS: CSS-Based 3D Engine Renders Polygon Meshes in HTML

Hacker News •
×

PolyCSS introduces a novel approach to 3D rendering by leveraging CSS matrix3d transforms to display polygon meshes directly in the DOM. The library converts 3D geometry into real HTML elements, supporting OBJ/MTL, GLB, and VOX formats with features like lighting, shadows, and animations.

Developers can integrate PolyCSS through vanilla JavaScript or framework-specific packages for React and Vue, using components like PolyCamera and PolyScene to manage viewpoints and lighting. The system optimizes performance by selecting the least expensive CSS primitive for each polygon, falling back to texture atlas slices only when necessary.

A standout feature exports rendered scenes to standalone HTML documents without requiring the PolyCSS runtime. The exportPolySceneSnapshot function inlines assets and strips scripts, creating portable snapshots of 3D content. Performance scales with polygon count and texture atlas area, making it suitable for moderate-complexity scenes.

Released under MIT license, PolyCSS offers a unique bridge between web standards and 3D graphics, enabling developers to create interactive 3D experiences using familiar CSS tooling rather than WebGL.