MCPcopy Index your code
hub / github.com/EliCDavis/polyform

github.com/EliCDavis/polyform @v0.38.0

Chat with this repo
repository ↗ · DeepWiki ↗ · release v0.38.0 ↗ · + Follow
4,827 symbols 18,255 edges 752 files 473 documented · 10%
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

Polyform Banner Coverage Go Report Card Go Reference CITATION.cff

Polyform is a toolkit for developers and artists to load, generate, edit, and export 3D geometry with a focus on immutability, modularity, and procedural workflows.

Developers and artists are welcome to join the Discord to share feedback, get help, or discuss feature requests.

Try in 30 Seconds

Try it now in your browser → Live Demo

To run it locally, you can download the latest release and run:

# Launches the node based editor
polyform edit

# If Golang is installed, clone and run:
go run ./cmd/polyform edit

# If Nix is installed, run:
nix run .#polyform edit

Package Overview

  • Formats
  • gltf - GLTF file format
  • obj - OBJ file format
  • ply - PLY file format
  • stl - STL file format
  • colmap - Utilities for loading COLMAP reconstruction data
  • opensfm - Utilities for loading OpenSFM reconstruction data
  • splat - Mkkellogg's SPLAT format
  • spz - Niantic Scaniverse's SPZ format
  • potree - Potree V2 file format
  • Modeling
  • extrude - Functionality for generating geometry from 2D shapes.
  • marching - Multi-threaded Cube Marching algorithm and utilities.
  • meshops - All currently implemented algorithms for transforming meshes.
  • primitives - Functionality pertaining to generating common geometry.
  • repeat - Functionality for copying geometry in common patterns.
  • triangulation - Generating meshes from a set of 2D points.
  • Drawing
  • coloring - Color utilities for blending multiple colors together using weights.
  • texturing - Traditional image processing utilities (common convolution kernels).
    • normals - Utilities for generating and editing normal maps.
  • Math
  • bias - Generic, temperature-scaled, biased random sampler for weighted selection of items
  • colors - Making working with golang colors not suck as much.
  • curves - Common curves used in animation like cubic bezier curves.
  • geometry - AABB, Line2D, Line3D, Plane, and Rays.
  • kmeans - Generic k-means clustering algorithm across 1D to 4D vector spaces.
  • mat - 4x4 Matrix implementation
  • morton - 3D Morton encoder that maps floating-point vectors to and from compact 64-bit Morton codes with configurable spatial bounds and resolution.
  • noise - Utilities around noise functions for common usecases like stacking multiple samples of perlin noise from different frequencies.
  • quaternion - Quaternion math and helper functions.
  • sdf - SDF implementations of different geometry primitives, along with common math functions. Basically slowly picking through Inigo Quilez's Distfunction article as I need them in my different projects.
  • sample - Serves as a group of definitions for defining a mapping from one numeric value to another.
  • trs - Math and utilities around TRS transformations.
  • Generator - Application scaffolding for editing and creating meshes.
  • Trees - Implementation of common spatial partitioning trees.

Packages that have spawned from polyform's undertaking and have since been refactored into their own repositories:

  • Node Flow - Another Flow-based Node Graph Library
  • vector - Immutable vector math library
  • jbtf - GLTF-inspired JSON schema for embedding arbitrary binaries
  • iter - Iterator and utilities. Some inspiration from ReactiveX
  • quill - Scheduler of operations on in-memory data
  • sfm - Utilities for interacting with reconstruction data from different SFM programs
  • bitlib - Utilities for reading and writing binary data

Contributing

Learn how to create your own nodes for others to use.

Procedural Generation Examples

You can at the different projects under the examples folder for different examples on how to procedurally generate meshes.

Evergreen Trees

This was my submission for ProcJam 2022.

[Source Here]

Evergreen Tree Demo

Other Examples

[Source Here] ufo [Source Here] candle
[Source Here] terrain [Source Here] terrain
[Source Here] plumbob [Source Here] oreo

Processing Example

Reads in a obj and applies the cube marching algorithm over the meshes 3D SDF.

package main

import (
  "github.com/EliCDavis/polyform/formats/obj"
  "github.com/EliCDavis/polyform/modeling"
  "github.com/EliCDavis/polyform/modeling/marching"
  "github.com/EliCDavis/polyform/modeling/meshops"
  "github.com/EliCDavis/vector"
)

func main() {
  objScene := obj.Load("test-models/stanford-bunny.obj")

  resolution := 10.
  scale := 12.

  transformedMesh := objScene.ToMesh().Transform(
    meshops.CenterAttribute3DTransformer{},
    meshops.ScaleAttribute3DTransformer{Amount: vector3.Fill(scale)},
  )

  canvas := marching.NewMarchingCanvas(resolution)
  meshSDF := marching.Mesh(transformedMesh, .1, 10)
  canvas.AddFieldParallel(meshSDF)

  obj.SaveMesh("chunky-bunny.obj", canvas.MarchParallel(.3))
}

Results in:

Chunky Bunny

Local Development

You can use air to live reload.

# .air.toml
[build]
  cmd = "go build -o ./tmp/main.exe ./cmd/polyform"
  include_ext = ["go", "tpl", "tmpl", "html", "js"]

The run:

air edit

If you want to mess with modern web browser features and need https, I recommend taking a look at https://github.com/FiloSottile/mkcert

mkcert -install
mkcert -key-file key.pem -cert-file cert.pem localhost
air edit --port 8080 --ssl

# If you want to connect to a vr headset
air edit --port 8080 --ssl --host 0.0.0.0

WASM Deployment

Compile the polywasm app

go install ./cmd/polywasm

Build your app

GOOS=js GOARCH=wasm go build -ldflags="-w -s" -o main.wasm ./cmd/polyform
polywasm build --wasm main.wasm

Then serve

polywasm edit

Citation

If Polyform contributes to an academic publication, cite it as:

@misc{polyform,
  title = {Polyform},
  author = {Eli Davis},
  note = {https://www.github.com/EliCDavis/polyform},
  year = {2025}
}

Extension points exported contracts — how you extend this code

Transformer (Interface)
(no doc) [30 implementers]
modeling/transform.go
Artifact (Interface)
(no doc) [9 implementers]
generator/manifest/artifact.go
OutputPort (Interface)
(no doc) [6 implementers]
nodes/node.go
Named (Interface)
(no doc) [14 implementers]
nodes/definitions.go
Versioned (Interface)
(no doc) [6 implementers]
nodes/version.go
PolyformAnimationSamplerData (Interface)
(no doc) [25 implementers]
formats/gltf/model.go
PropertyWriter (Interface)
============================================================================ [4 implementers]
formats/ply/writer.go
Element (Interface)
(no doc) [8 implementers]
trees/element.go

Core symbols most depended-on inside this repo

New
called by 1478
refutil/type_factory.go
Equal
called by 772
drawing/texturing/texture.go
X
called by 570
math/sdf/mirror.go
Y
called by 568
math/sdf/mirror.go
Set
called by 516
nodes/node.go
TryGetOutputValue
called by 502
nodes/node_output.go
At
called by 369
math/curves/spline.go
Add
called by 340
nodes/node.go

Shape

Method 2,344
Function 1,318
Struct 788
Class 172
Interface 119
TypeAlias 70
FuncType 12
Enum 4

Languages

Go84%
TypeScript11%
C#5%

Modules by API surface

drawing/texturing/texture.go94 symbols
modeling/mesh.go86 symbols
generator/graph/instance.go59 symbols
website/requests.ts57 symbols
formats/gltf/nodes.go57 symbols
nodes/struct.go54 symbols
formats/gltf/extensions.go49 symbols
math/nodes.go48 symbols
generator/cli/flags.go42 symbols
formats/gltf/read_test.go41 symbols
generator/variable/system.go40 symbols
drawing/coloring/nodes.go40 symbols

For agents

$ claude mcp add polyform \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact