dc

package
v0.0.0-...-f96937a Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 25, 2022 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DualContouringV1

type DualContouringV1 struct {
	// Simplify: how much to simplify (if >=0).
	// NOTE: Meshing might fail with simplification enabled (FIXME),
	// but the mesh might can still simplified later using external tools (the main benefit of dual contouring is sharp edges).
	Simplify float64
	// RCond [0, 1) is the parameter that controls the accuracy of sharp edges, with lower being more accurate
	// but it can cause instability leading to large wrong triangles. Leave the default if unsure.
	RCond float64
	// LockVertices makes sure each vertex stays in its voxel, avoiding small or bad triangles that may be generated
	// otherwise, but it also may remove some sharp edges.
	LockVertices bool
}

DualContouringV1 renders using dual contouring (octree sampling, sharp edges!, automatic simplification)

func NewDualContouringV1

func NewDualContouringV1(simplify float64, RCond float64, lockVertices bool) *DualContouringV1

NewDualContouringV1 see DualContouringV1

func (*DualContouringV1) Info

func (m *DualContouringV1) Info(s sdf.SDF3, meshCells int) string

Info returns a string describing the rendered volume.

func (*DualContouringV1) Render

func (m *DualContouringV1) Render(s sdf.SDF3, meshCells int, output chan<- *render.Triangle3)

Render produces a 3d triangle mesh over the bounding volume of an sdf3.

type DualContouringV2

type DualContouringV2 struct {
	// FarAway fixes bad triangles that may be generated by limiting the maximum vertex displacement
	// from the voxel's center to the specified amount (manhattan distance), and clamping if exceeded.
	FarAway float64
	// CenterPush may generate a better mesh if larger at the cost of less sharp edges.
	CenterPush float64

	// see sdf.Raycast3
	RaycastScaleAndSigmoid, RaycastStepScale, RaycastEpsilon float64
	// see sdf.Raycast3
	RaycastMaxSteps int
	// contains filtered or unexported fields
}

DualContouringV2 renders a SDF using dual contouring (sharp edges!). You may need to test several settings to find the best for your purposes.

func NewDualContouringDefault

func NewDualContouringDefault() *DualContouringV2

NewDualContouringDefault uses somewhat safe defaults that sacrifice performance, you may reduce max steps and fix other parameters if facing errors

func NewDualContouringV2

func NewDualContouringV2(farAway float64, centerPush float64, raycastScaleAndSigmoid, raycastStepSize float64, raycastEpsilon float64, raycastMaxSteps int) *DualContouringV2

NewDualContouringV2 see DualContouringV2 and its fields

func (*DualContouringV2) Info

func (dc *DualContouringV2) Info(s sdf.SDF3, meshCells int) string

Info returns a string describing the rendered volume.

func (*DualContouringV2) Render

func (dc *DualContouringV2) Render(s sdf.SDF3, meshCells int, output chan<- *render.Triangle3)

Render produces a 3d triangle mesh over the bounding volume of an sdf3.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL