Browser based 3D model visualizer for use with soypat/sdf package. 3 minute Youtube demo and tutorial here.
Before installing make sure your GOBIN
environment variable is set to a folder in your PATH.
go install github.com/soypat/sdf3ui@latest
- Create a
.go
extension file of any name in an empty folder. Copy the following contents into it. - Run
go mod init my-awesome-module
in the directory followed bygo mod tidy
to download dependecies. - Run
sdf3ui thefile.go
in the directory.
package main
import (
"log"
"os"
"github.com/soypat/sdf"
"github.com/soypat/sdf/form3"
"github.com/soypat/sdf/render"
"github.com/soypat/sdf3ui/uirender"
"gonum.org/v1/gonum/spatial/r3"
)
func main() {
var object sdf.SDF3
object, _ = form3.Box(r3.Vec{4, 3, 2}, 1)
cone, _ := form3.Cone(6, 1, 0, .1)
union := sdf.Union3D(object, cone)
union.SetMin(sdf.MinPoly(1, .4))
object = union
err := uirender.EncodeRenderer(os.Stdout, render.NewOctreeRenderer(object, 200))
if err != nil {
log.Fatal(err)
}
}
If building from source run go generate
to generate assets
folder structure and contents.
To run app run go run . example/mybolt.go
and head over to http://localhost:8080
- sdfx-ui Real-time rendering using Faux-GL renderer for sdfx