polyform

Immutable mesh processing library

https://github.com/elicdavis/polyform

Science Score: 44.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (11.5%) to scientific vocabulary

Keywords

3d gaussian-splatting generative-art geometry geometry-processing gltf mesh mesh-processing node-editor obj ply procedural-generation

Keywords from Contributors

standards hack interpretability data-profiling finite-volume interaction bridges state-management laser transformers
Last synced: 4 months ago · JSON representation ·

Repository

Immutable mesh processing library

Basic Info
Statistics
  • Stars: 201
  • Watchers: 7
  • Forks: 19
  • Open Issues: 21
  • Releases: 40
Topics
3d gaussian-splatting generative-art geometry geometry-processing gltf mesh mesh-processing node-editor obj ply procedural-generation
Created over 6 years ago · Last pushed 4 months ago
Metadata Files
Readme Funding License Citation

README.md

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:

```bash

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

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.

```go 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.

```toml

.air.toml

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

The run:

bash 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

```bash 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

bash go install ./cmd/polywasm

Build your app

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

Then serve

bash 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} }

Owner

  • Name: Eli Davis
  • Login: EliCDavis
  • Kind: user
  • Location: sao
  • Company: Recolude

Founder of @Recolude Developing for VR and all things associated

Citation (CITATION.cff)

# This CITATION.cff file was generated with cffinit.
# Visit https://bit.ly/cffinit to generate yours today!

cff-version: 1.2.0
title: Polyform
message: Immutable mesh generation library
type: software
authors:
  - given-names: Elijah
    family-names: Davis
repository-code: 'https://github.com/EliCDavis/polyform'
keywords:
  - sdf
  - marching-cubes
license: MIT
version: v0.18.0

GitHub Events

Total
  • Create event: 37
  • Release event: 25
  • Issues event: 13
  • Watch event: 106
  • Delete event: 3
  • Issue comment event: 40
  • Push event: 327
  • Pull request review event: 67
  • Pull request review comment event: 60
  • Pull request event: 104
  • Fork event: 11
Last Year
  • Create event: 37
  • Release event: 25
  • Issues event: 13
  • Watch event: 106
  • Delete event: 3
  • Issue comment event: 40
  • Push event: 327
  • Pull request review event: 67
  • Pull request review comment event: 60
  • Pull request event: 104
  • Fork event: 11

Committers

Last synced: 8 months ago

All Time
  • Total Commits: 532
  • Total Committers: 6
  • Avg Commits per committer: 88.667
  • Development Distribution Score (DDS): 0.331
Past Year
  • Commits: 262
  • Committers: 6
  • Avg Commits per committer: 43.667
  • Development Distribution Score (DDS): 0.45
Top Committers
Name Email Commits
Eli Davis e****5@g****m 356
GitHub Action a****n@g****m 130
github-actions[bot] 4****] 16
Alex Kotenko a****t@g****m 15
Kaleb Pace k****e@p****e 9
dependabot[bot] 4****] 6
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 4 months ago

All Time
  • Total issues: 31
  • Total pull requests: 127
  • Average time to close issues: 3 months
  • Average time to close pull requests: 2 days
  • Total issue authors: 3
  • Total pull request authors: 5
  • Average comments per issue: 0.42
  • Average comments per pull request: 0.43
  • Merged pull requests: 109
  • Bot issues: 0
  • Bot pull requests: 63
Past Year
  • Issues: 6
  • Pull requests: 111
  • Average time to close issues: 6 days
  • Average time to close pull requests: 2 days
  • Issue authors: 2
  • Pull request authors: 5
  • Average comments per issue: 0.5
  • Average comments per pull request: 0.42
  • Merged pull requests: 94
  • Bot issues: 0
  • Bot pull requests: 55
Top Authors
Issue Authors
  • EliCDavis (29)
  • suprafun (1)
  • alexykot (1)
Pull Request Authors
  • github-actions[bot] (52)
  • alexykot (36)
  • kalebpace (22)
  • EliCDavis (20)
  • dependabot[bot] (9)
Top Labels
Issue Labels
enhancement (16) good first issue (9) Web View (5) bug (2) Export (2) Generator (2) go (1)
Pull Request Labels
dependencies (61) automated (52) go (3) github_actions (2) javascript (2)

Dependencies

go.mod go
  • github.com/EliCDavis/vector v0.0.0-20221214034925-f4542b232de4
  • github.com/cpuguy83/go-md2man/v2 v2.0.2
  • github.com/davecgh/go-spew v1.1.1
  • github.com/fogleman/gg v1.3.0
  • github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
  • github.com/pmezard/go-difflib v1.0.0
  • github.com/russross/blackfriday/v2 v2.1.0
  • github.com/stretchr/testify v1.8.1
  • github.com/urfave/cli/v2 v2.23.7
  • github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673
  • golang.org/x/image v0.2.0
  • gopkg.in/yaml.v3 v3.0.1
go.sum go
  • github.com/BurntSushi/toml v1.2.1
  • github.com/EliCDavis/vector v0.0.0-20221214034925-f4542b232de4
  • github.com/cpuguy83/go-md2man/v2 v2.0.2
  • github.com/davecgh/go-spew v1.1.0
  • github.com/davecgh/go-spew v1.1.1
  • github.com/fogleman/gg v1.3.0
  • github.com/golang/freetype v0.0.0-20170609003504-e2365dfdc4a0
  • github.com/pmezard/go-difflib v1.0.0
  • github.com/russross/blackfriday/v2 v2.1.0
  • github.com/stretchr/objx v0.1.0
  • github.com/stretchr/objx v0.4.0
  • github.com/stretchr/objx v0.5.0
  • github.com/stretchr/testify v1.7.1
  • github.com/stretchr/testify v1.8.0
  • github.com/stretchr/testify v1.8.1
  • github.com/urfave/cli/v2 v2.23.7
  • github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673
  • github.com/yuin/goldmark v1.4.13
  • golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2
  • golang.org/x/crypto v0.0.0-20210921155107-089bfa567519
  • golang.org/x/image v0.2.0
  • golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4
  • golang.org/x/net v0.0.0-20190620200207-3b0461eec859
  • golang.org/x/net v0.0.0-20210226172049-e18ecbb05110
  • golang.org/x/net v0.0.0-20220722155237-a158d28d115b
  • golang.org/x/sync v0.0.0-20190423024810-112230192c58
  • golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4
  • golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a
  • golang.org/x/sys v0.0.0-20201119102817-f84b799fce68
  • golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1
  • golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a
  • golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f
  • golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1
  • golang.org/x/term v0.0.0-20210927222741-03fcf44c2211
  • golang.org/x/text v0.3.0
  • golang.org/x/text v0.3.3
  • golang.org/x/text v0.3.7
  • golang.org/x/text v0.5.0
  • golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e
  • golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e
  • golang.org/x/tools v0.1.12
  • golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7
  • gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405
  • gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c
  • gopkg.in/yaml.v3 v3.0.1
.github/workflows/cff-validator-complete.yml actions
  • actions/checkout v3 composite
  • dieghernan/cff-validator main composite
.github/workflows/codeql.yml actions
  • actions/checkout v3 composite
  • github/codeql-action/analyze v2 composite
  • github/codeql-action/autobuild v2 composite
  • github/codeql-action/init v2 composite
.github/workflows/test.yml actions
  • actions/cache v2 composite
  • actions/checkout v2 composite
  • actions/setup-go v2 composite
  • ad-m/github-push-action master composite
  • tj-actions/coverage-badge-go v2 composite
  • tj-actions/verify-changed-files v12 composite