Polycss logo

Polycss

Organization
layoutit
polycss

Build PolyCSS scenes that render 3D meshes, primitive shapes, or custom polygons as DOM/CSS polygon elements. Use when asked to create, port, debug, or explain PolyCSS code in vanilla JavaScript, React, or Vue.

Overview

Publisherlayoutit
Repositorypolycss
Skill namepolycss
Stars
768
Forks
22
Bundled files
13
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • 13 bundled files

    Scripts, templates, and references the model can read while it works. Files are read-only and never executed.

  • Open source

    Published by layoutit on GitHub. Read the source before you install it.

Installation

Install the Polycss AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/layoutit/polycss/tree/main/packages/skills/skill
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/layoutit/polycss.git /tmp/polycss
mkdir -p .claude/skills
cp -r /tmp/polycss/packages/skills/skill .claude/skills/polycss
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Polycss in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Polycss on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Polycss is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

PolyCSS — DOM 3D Rendering

PolyCSS renders 3D polygon meshes as real DOM elements transformed with CSS matrix3d(...). No WebGL, no canvas-per-frame. It supports OBJ/MTL, STL, glTF/GLB, VOX, generated primitives, colors, textures, dynamic lighting, shadows, controls, selection, animation, and per-polygon interaction.

Use native PolyCSS when authoring PolyCSS-first scenes. Use the Three.js parity API when porting Three.js code or generating code from Three-shaped examples.

Reference docs

Read the file that matches the task before writing non-trivial code.

FileRead it when
docs/authoring-polygons.mdGenerating Polygon[] by hand. Winding, color format, coplanarity, the optimizer. Silent-failure rules.
docs/scenes-and-cameras.mdSetting up a scene, camera props, scene options, custom elements, coordinates.
docs/shapes-and-primitives.mdBoxes, spheres, planes, Platonic solids, raw polygon generators.
docs/loading-models.mdloadMesh, <PolyMesh src>, OBJ/MTL/STL/glTF/GLB/VOX, parse options.
docs/lighting.mdDirectional/ambient/point lights, baked vs dynamic, rebaking.
docs/shadows.mdcastShadow, receiveShadow, parametric shadows, renderer differences.
docs/textures.mdUV textures, the atlas pipeline, texture quality, presentation options.
docs/controls-and-interaction.mdOrbit/map/first-person controls, selection, transform gizmos, click handlers.
docs/animation.mdSkeletal clips from glTF/GLB, usePolyAnimation, stable DOM.
docs/performance.mdLeaf counts, render strategies, atlas memory, voxel fast paths.
docs/three-parity.mdPorting Three.js scenes through the */three subpaths.
docs/troubleshooting.mdSomething renders wrong. Symptom → cause table.
docs/api-index.md"Does this export exist?" Package-by-package export inventory.

Packages

PackageUse
@layoutit/polycssVanilla + custom elements. Re-exports all of core.
@layoutit/polycss-reactReact components and hooks. Re-exports core.
@layoutit/polycss-vueVue 3 mirror of React. Re-exports core.
@layoutit/polycss-corePure math and parsers, zero browser globals (Node, workers).
@layoutit/polycss-fontsText → extruded 3D Polygon[].
@layoutit/polycss-morphPrepared models with retained DOM, morphs, skinning, playback.

React and Vue depend on core only, so do not import renderer or component APIs from @layoutit/polycss in a React or Vue app — use the framework package, and take anything it does not re-export from @layoutit/polycss-core.

The one documented exception is exportPolySceneSnapshot, which lives only in @layoutit/polycss because it is browser DOM serialization rather than component API; React and Vue callers import it from there and pass the rendered element. See docs/api-index.md.

The public API is mirrored between React and Vue: same names, same defaults, idiomatic differences only (refs vs reactives).

Imports

ts
import {
  createPolyCamera,
  createPolyPerspectiveCamera,
  createPolyScene,
  createPolyOrbitControls,
  createPolyBox,
  createPolyPlane,
  loadMesh,
} from "@layoutit/polycss";
tsx
import {
  PolyCamera,
  PolyPerspectiveCamera,
  PolyScene,
  PolyMesh,
  PolyGround,
  PolyOrbitControls,
  Poly,
} from "@layoutit/polycss-react"; // or "@layoutit/polycss-vue"

Conventions

  • Coordinates are PolyCSS world space [x, y, z] with +Z up. World Y maps to CSS X (screen-right at identity rotation) and world X to CSS Y (screen-down); the default camera (rotX: 65, rotY: 45) presents that as an isometric view.
  • Camera rotations are degrees: rotX, rotY.
  • zoom is on-screen CSS pixels per world unit (default 0.65; orbit controls clamp to 0.1–10 by default). BASE_TILE (50) is the world-unit → CSS px factor; you need it when converting world units to raw CSS pixels yourself — e.g. <poly-iframe width> mounts a document width × 50 px wide.
  • PolyCamera / createPolyCamera are orthographic by default (this deliberately diverges from three.js). Use PolyPerspectiveCamera / createPolyPerspectiveCamera for depth foreshortening.
  • The camera is the outer node; the scene nests inside it. CSS perspective only applies to descendants.
  • Do not infer names from a prefix rule. Poly prefixing is a convention for newer renderer-facing components, hooks and types — not a description of the export inventory. Plenty of public names have no prefix: loadMesh, parseObj / parseStl / parseGltf / parseVox, every *Polygons generator, BASE_TILE, LoopOnce / LoopRepeat / LoopPingPong, the generic math types (Vec2, Vec3, Polygon), and the vanilla factories createSelect and createTransformControls. The */three subpaths use Three-compatible names deliberately. Check docs/api-index.md rather than guessing.

Authoring polygons — the five silent failures

A Polygon is a plain object; vertices is the only required field.

ts
interface Polygon {
  vertices: [number, number, number][];  // 3+ points, CCW seen from outside
  color?: string;                        // hex or rgb()/rgba() ONLY
  texture?: string;                      // image URL
  uvs?: [number, number][];              // one per vertex
  material?: PolyMaterial;               // shared material; material.texture wins over `texture`
  data?: Record<string, string | number | boolean>;  // → data-* attributes
}

These constraints fail with no throw and no console warning:

  1. Winding decides visibility. Vertex order sets the normal by the right-hand rule ((v1-v0) × (v2-v0)), and PolyCSS backface-culls every leaf. Wind counter-clockwise as seen from the side you want to look at.
  2. color is not a full CSS color. Only #rgb, #rrggbb, rgb(), and rgba() parse. "tomato", hsl(), and color() render white.
  3. Non-triangular polygons must be coplanar, or they are flattened onto their average plane and crack against their neighbours. Triangles are safe.
  4. The optimizer rewrites geometry by default (merge: true, meshResolution: "lossy"). Pass { merge: false } to render your array as authored.
  5. Degenerate polygons vanish silently — under 3 vertices, zero area, or a degenerate first edge.

Read docs/authoring-polygons.md in full before generating geometry — it covers per-parser winding behaviour, which entry points normalize, and the exact optimizer thresholds.

Minimal scene

Vanilla:

ts
const camera = createPolyCamera({ rotX: 65, rotY: 45 });
const scene = createPolyScene(document.getElementById("host")!, {
  camera,
  textureLighting: "dynamic",
  directionalLight: { direction: [0.5, -0.6, 0.7], color: "#ffffff", intensity: 1 },
  ambientLight: { color: "#ffffff", intensity: 0.35 },
});

createPolyOrbitControls(scene, { drag: true, wheel: true });

scene.add(createPolyBox({ size: 100, color: "#ffd166" }), { position: [0, 0, 50] });
scene.add(await loadMesh("/model.glb"), { castShadow: true });
// Vanilla has no ground fallback — a caster needs an explicit receiver.
scene.add(createPolyPlane({ axis: 2, size: 60, offset: 0, color: "#7d848e" }), { receiveShadow: true });

React (Vue mirrors this with kebab-case props):

tsx
<PolyCamera rotX={65} rotY={45}>
  <PolyScene
    textureLighting="dynamic"
    ambientLight={{ intensity: 0.35 }}
    directionalLight={{ direction: [0.5, -0.6, 0.7], intensity: 1 }}
  >
    <PolyOrbitControls drag wheel />
    <PolyMesh src="/model.glb" autoCenter castShadow />
    <PolyGround size={8} />
    {polygons.map((p, i) => <Poly key={i} {...p} onClick={() => select(i)} />)}
  </PolyScene>
</PolyCamera>

Custom elements (no build step):

html
<script type="module" src="https://esm.sh/@layoutit/polycss/elements"></script>

<poly-camera rot-x="65" rot-y="45">
  <poly-scene>
    <poly-orbit-controls drag wheel></poly-orbit-controls>
    <poly-mesh src="/model.glb"></poly-mesh>
  </poly-scene>
</poly-camera>

Rules of thumb

  • Polygon count is the dominant cost. One visible polygon = one DOM leaf, one matrix3d, one paint. Halving polygon count beats every other optimisation.
  • Never run a requestAnimationFrame loop to update many leaves. Camera, mesh, and light motion are single-ancestor CSS updates. If you find yourself writing a per-frame loop over polygons, you are fighting the engine.
  • Prefer textureLighting: "dynamic" for live or animated lights (zero JS per light change). Prefer "baked" for point lights and maximum fidelity.
  • scene.destroy() and result.dispose() release atlas blob URLs. The mesh element and usePolyMesh do it for you.

Full documentation: https://polycss.com

Bundled files

The model reads these on demand while the skill is loaded. They are exposed as readable files and are never executed.

Frequently asked questions

What does the Polycss AI skill do?

Build PolyCSS scenes that render 3D meshes, primitive shapes, or custom polygons as DOM/CSS polygon elements. Use when asked to create, port, debug, or explain PolyCSS code in vanilla JavaScript, React, or Vue.

Why use Polycss on TypingMind?

Because you install it once and use it with any model. Polycss is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Polycss in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/layoutit/polycss/tree/main/packages/skills/skill. TypingMind reads its SKILL.md and bundles its files and installs it as a skill you can enable per chat.

Which AI models can use Polycss?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Polycss?

As many as you like. As long as a model supports skills, you can use Polycss with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Polycss AI skill free?

Yes. It is published on GitHub by layoutit under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇