Paste a Wavefront
.objmodel and turn it into inline SVG, a standalone HTML page, or raw JSON — entirely in your browser.
obj-to-css is a small, fully client-side web app that parses a 3D model in the Wavefront OBJ format, renders it as a flat-shaded SVG with simple lighting and a painter's-algorithm depth sort, and lets you export the result in three formats. No backend, nothing uploaded — everything runs in the browser.
- 🧩 OBJ parser — reads
v(vertices) andf(faces), auto-triangulates polygons, then normalizes and centers the model. - 🎛️ Live camera — rotate (X / Y) and zoom with sliders; the preview updates in real time.
- 💡 Flat shading — per-face normals drive brightness, and faces are depth-sorted with the painter's algorithm.
- 📦 Built-in presets —
diamante,cubo,piramide,icosaedro,casetta,Rounded-Cube. - 📤 Three export formats:
- HTML — a self-contained page with the inline SVG and styles.
- SVG — a standalone
<svg>you can drop anywhere. - JSON — per-face points, colors, and depth data.
- 📋 One-click copy to the clipboard.
# install dependencies
npm install
# start the dev server
npm run devThen open http://localhost:3000.
| Command | Description |
|---|---|
npm run dev |
Start the development server |
npm run build |
Create a production build |
npm run start |
Serve the production build |
npm run lint |
Run ESLint |
- Pick a preset or paste your own OBJ into the input box.
- Adjust Rotation Y / Rotation X / Zoom to frame the model.
- Choose an export tab — HTML, SVG, or JSON.
- Click Copy and paste the code wherever you need it.
Only geometry is used: vertex lines (v x y z) and face lines (f a b c …).
Faces with more than three vertices are triangulated. Texture/normal indices in
face entries (a/b/c) are accepted but ignored — only the vertex index is read.
Materials, vertex normals (vn), and texture coordinates (vt) are not used.
- Next.js 16 (App Router)
- React 19
- TypeScript 5
- Tailwind CSS 4
app/
├─ page.tsx # the whole app: OBJ parser, renderer, UI, exporters
├─ layout.tsx # root layout & metadata
├─ presets/
│ └─ cube.ts # generated Rounded-Cube preset
├─ globals.css # global styles
└─ style.css # app styles
Issues and pull requests are welcome. main is protected, so changes land via PR:
fork the repo, open a PR, and it'll be reviewed before merging.
Released under the Apache-2.0 license.