Immutable mesh processing library
Polyform is for loading, generating, editing, and exporting 3D geometry and it's associated data.
Packages that have spawned from polyform's undertaking and have since been refactored into their own repositories:
You can at the different projects under the examples folder for different examples on how to procedurally generate meshes.
This was my submission for ProcJam 2022. Pretty much uses every bit of functionality available in this repository.
[Source Here] | [Source Here] |
[Source Here] | [Source Here] |
[Source Here] | [Source Here] |
If you so happen to want to build a configurator example, my preferred workflow is:
Set up the example to use the generator
package that allows you to quickly spin up a web viewer to visualize the geoemetry of your program.
Use air to live reload the examples as you build them out.
Set cmd = "go build -o ./tmp/main.exe ./examples/MY_EXAMPLE"
.
Set include_ext = ["go", "tpl", "tmpl", "html", "js"]
.
air serve --port 8080
As you hit save on your go code, the webserver will restart, and the web page will automatically refresh itself.
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 serve --port 8080 --ssl
# And if you want to connect with your headset
air serve --port 8080 --ssl --host 0.0.0.0
Compile the polywasm
app
go install ./cmd/polywasm
Then build your example app
polywasm build --app-path ./examples/MY_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() {
loadedMesh, _ := obj.Load("test-models/stanford-bunny.obj")
resolution := 10.
scale := 12.
transformedMesh := loadedMesh.Transform(
meshops.Center3DTransformer{},
meshops.Scale3DTransformer{Amount: vector3.Fill(scale)},
)
canvas := marching.NewMarchingCanvas(resolution)
meshSDF := marching.Mesh(transformedMesh, .1, 10)
canvas.AddFieldParallel(meshSDF)
obj.Save("chunky-bunny.obj", canvas.MarchParallel(.3))
}
Results in:
Progress towards V1...
Things I want to implement eventually...
Resources either directly contributing to the code, or are just interesting finds while researching.
Libraries the Webviewer depends on in some capacity
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 = {2024}
}