Skip to content
/ sdf3ui Public

Browser based 3D model visualizer for use with soypat/sdf package.

License

Notifications You must be signed in to change notification settings

soypat/sdf3ui

Repository files navigation

sdf3ui

Browser based 3D model visualizer for use with soypat/sdf package. 3 minute Youtube demo and tutorial here.

sdf3ui

Installation

Before installing make sure your GOBIN environment variable is set to a folder in your PATH.

go install github.com/soypat/sdf3ui@latest

Example of usage

  1. Create a .go extension file of any name in an empty folder. Copy the following contents into it.
  2. Run go mod init my-awesome-module in the directory followed by go mod tidy to download dependecies.
  3. 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)
	}
}

example_screenshot

Build from source

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

Related projects

  • sdfx-ui Real-time rendering using Faux-GL renderer for sdfx

About

Browser based 3D model visualizer for use with soypat/sdf package.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published