Skip to content

About

Browser app that converts Wavefront .obj 3D models into inline SVG, a standalone HTML page, or JSON — Next.js + React, no backend.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

obj-to-css

Paste a Wavefront .obj model and turn it into inline SVG, a standalone HTML page, or raw JSON — entirely in your browser.

Next.js React TypeScript Tailwind CSS License: Apache-2.0

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.


Features

  • 🧩 OBJ parser — reads v (vertices) and f (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.

Getting started

# install dependencies
npm install

# start the dev server
npm run dev

Then open http://localhost:3000.

Scripts

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

Usage

  1. Pick a preset or paste your own OBJ into the input box.
  2. Adjust Rotation Y / Rotation X / Zoom to frame the model.
  3. Choose an export tab — HTML, SVG, or JSON.
  4. Click Copy and paste the code wherever you need it.

Supported OBJ subset

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.

Tech stack

Project structure

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

Contributing

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.

License

Released under the Apache-2.0 license.

About

Browser app that converts Wavefront .obj 3D models into inline SVG, a standalone HTML page, or JSON — Next.js + React, no backend.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages