alt.hn

6/1/2026 at 1:58:04 PM

Show HN: A CSS 3D Engine (no WebGL)

https://github.com/LayoutitStudio/polycss

by rofko

6/1/2026 at 8:11:40 PM

Over a weekend about a decade ago, I toyed with making a Final Fantasy Tactics-like game in the browser using CSS for the renderer. I could not get it to work in the time I gave it. I realized too late I needed to make some abstractions and stop trying to manipulate CSS directly.

Which is a long way of saying I appreciate how challenging this probably was to figure out. I love stuff like this.

by madrox

6/1/2026 at 3:49:55 PM

But why not use WebGL? It's widely available, more efficient, and can render at a much higher quality.

https://polycss.com/gallery/?model=2843066616

https://threejs.org/examples/#webgl_animation_multiple

by Rohansi

6/1/2026 at 4:21:02 PM

Hi there! This is not trying to be a three.js replacement, scenes with huge polygon counts naturally should render in canvas.

For me, the interesting case is smaller low-poly or voxel scenes where loading a full 3D stack may be overkill, and where keeping the scene in DOM/CSS gives you easier integration with normal layout, styling, events, etc. Once you have the HTML, you don't even need to load the library to render a static model.

Also, part of the experiment is testing the browser’s limits and getting a clearer sense of where this approach works, where it breaks down, and what the tradeoffs are.

Cheers!

by rofko

6/1/2026 at 5:10:32 PM

ha, so you could run this on the server and send down a page with no javascript at all? (with, i assume, a static camera only.) that's fun. i mean, you could also just render the model to an image at that point, but still, this is neat.

by woodrowbarlow

6/1/2026 at 5:51:46 PM

You can have a dynamic camera with 3D CSS only and no JS. The trick is move the scene instead of the "camera". CSS Doom uses this technique (although unlike the project I'm working on, it relies heavily on JS for the interaction logic).

by semolino

6/1/2026 at 5:47:47 PM

Yes, you can render on server and if you include CSS transitions/animations, you get an animated 3d render without the need for JS !

We haven't built it yet, but its on the roadmap

by apresmoi

6/1/2026 at 6:04:46 PM

I'm all for experimentation but getting rid of JS in this case almost certainly results in worse performance. You're trading a bit of load time for significantly slower runtime/rendering.

by Rohansi

6/1/2026 at 7:02:58 PM

Huh.... why would a CSS animation of a transform be slower than JS? This is strictly for the "CSS transform" case ofc - obviously pure webgl would be way faster.

I'm having a hard time seeing it. My experiments with CSS animation have always performed much better in CSS than JS (again, excluding it being pure webgl/canvas JS).

And ofc there's the nice bonus that it works if I haven't chosen to trust and whitelist their website for JS yet.

by capitainenemo

6/1/2026 at 7:47:53 PM

I meant slower vs. WebGL rendering, which requires JS. Each triangle is rendered as a DOM node. There can be thousands of triangles in a single model.

The gallery has been updated with more models. Compare the same model in PolyCSS vs. Three.js:

https://polycss.com/gallery/?model=205023689 (13 fps)

https://threejs.org/examples/#webgl_animation_skinning_morph (60 fps)

by Rohansi

6/1/2026 at 8:53:34 PM

Oh. Sure, that is pretty obvious. A triangle in webgl is so much more lightweight than building it out of DOM elements but this was more about "if one is going to use this CSS system, why not support a pure CSS viewing mode" - which right now, it does not - rotation requires JS and is pretty stuttery. I was thinking it should actually be a bit smoother if there was a "toggle on/off rotation using a CSS animation" option. Plus, something like that could easily be done in pure CSS if JS was disabled, which would make the output all the more accessible and offer a good usecase.

It could also be helpful in scenarios where JS is restricted - emails? iframes? bulleting board user content? Dunno. Trying to come up with some that aren't just "nemo was running umatrix and doesn't trust your site just yet"

by capitainenemo

6/1/2026 at 9:29:54 PM

It's like transcoding a video into a GIF so that it can render everywhere. It will probably work but it's not really a serious option.

by Rohansi

6/1/2026 at 7:57:35 PM

That is a good observation, being able to do a 3D animation only with HTML+CSS means that it works on js blocked websites!

Of course that the animations won't map to all the animations you can manage with js.

by apresmoi

6/1/2026 at 4:15:09 PM

Same thought. Even that simple Apple on the front pages runs < 60fps on my M1 Mac. Rendering 3D objects with CSS is like rendering Doom in Excel Cells. Yes, you can do it. No you should not do it except as a joke/curiosity.

by socalgal2

6/1/2026 at 9:33:37 PM

The per-polygon DOM events are what make this more than a trick. Getting click handlers on individual faces in WebGL means raycasting. Here it's just onClick. For certain use cases that's the whole argument.

by 1taimoorkhan0

6/1/2026 at 4:50:53 PM

Always thought it would be cool to make an RTS or simple city builder game in the browser.

Would you recommend this for hacking around or not?

by tomaytotomato

6/1/2026 at 5:11:34 PM

It’s a wide range from an RTS to a simple city builder. I’d say “no” for the former and “maybe” for the latter. Perhaps try it for a couple of hours and see whether you like it or not.

by thih9

6/1/2026 at 5:27:11 PM

I think the answer is no, as this is a creative repurposing of css3d as a basis for a general 3d engine. That lets you put web content everywhere, even on the triangles of your teapot. Cool, but extravagant

Whereas THREE.js or webgl is purpose-built for realtime animated 3d scenes.

by blueboo

6/1/2026 at 6:07:17 PM

This reminds me of the 3D maps in corru.observer, which also only used CSS transforms

by tajoma

6/1/2026 at 4:30:36 PM

wow thats cool

by sgm1018

6/1/2026 at 7:45:32 PM

[flagged]

by alinarashid1