Documentation
¶
Index ¶
- Constants
- func BlockIntegrate(s *Scene, in Integrator, log log.Logger) <-chan Fragment
- func SimpleIntegrate(s *Scene, in Integrator, log log.Logger) <-chan Fragment
- func WorkerIntegrate(s *Scene, in Integrator, log log.Logger) <-chan Fragment
- type BSDF
- type Background
- type Camera
- type ClipPrimitive
- type Clipper
- type Collision
- type DifferentialRay
- type Differentials
- type DiracLight
- type EmitMaterial
- type Fragment
- type GatherResult
- type Image
- type Integrator
- type Intersecter
- type IntersecterBuilder
- type Light
- type LightIntersecter
- type LightSample
- type Material
- type MaterialSample
- type Mesh
- type Object3D
- type ObjectID
- type Photon
- type PhotonMap
- func (pm *PhotonMap) AddPhoton(p Photon)
- func (pm *PhotonMap) Clear()
- func (pm *PhotonMap) Dimension(i int, axis vecutil.Axis) (float64, float64)
- func (pm *PhotonMap) FindNearest(p, n vec64.Vector, dist float64) (nearest Photon)
- func (pm *PhotonMap) Gather(p vec64.Vector, nLookup int, maxDist float64) []GatherResult
- func (pm *PhotonMap) Len() int
- func (pm *PhotonMap) NumPaths() int
- func (pm *PhotonMap) Ready() bool
- func (pm *PhotonMap) SetNumPaths(np int)
- func (pm *PhotonMap) Update()
- type PhotonSample
- type Primitive
- type PrimitiveObject
- type Ray
- type RenderState
- type Samplable
- type SamplableObject3D
- type Scene
- func (s *Scene) AddLight(l Light) (err error)
- func (s *Scene) AddMaterial(name string, m Material) (err error)
- func (s *Scene) AddObject(obj Object3D) (id ObjectID, err error)
- func (s *Scene) AddVolumeRegion(vr VolumeRegion)
- func (s *Scene) Background() Background
- func (s *Scene) Bound() bound.Bound
- func (s *Scene) Camera() Camera
- func (s *Scene) DoDepth() bool
- func (s *Scene) GetObject(id ObjectID) (obj Object3D, found bool)
- func (s *Scene) Intersect(r Ray, dist float64) Collision
- func (s *Scene) Lights() []Light
- func (s *Scene) SetAntialiasing(numSamples, numPasses, incSamples int, threshold float64)
- func (s *Scene) SetBackground(bg Background)
- func (s *Scene) SetCamera(cam Camera)
- func (s *Scene) Shadowed(r Ray, dist float64) bool
- func (s *Scene) Update() (err error)
- type SurfaceIntegrator
- type SurfacePoint
- type TransparentMaterial
- type Triangle
- func (tri *Triangle) Bound() (bd bound.Bound)
- func (tri *Triangle) CalculateNormal()
- func (tri *Triangle) ClearNormals()
- func (tri *Triangle) ClearUVs()
- func (tri *Triangle) Clip(bound bound.Bound, axis vecutil.Axis, lower bool, oldData interface{}) (clipped bound.Bound, newData interface{})
- func (tri *Triangle) GetNormal() vec64.Vector
- func (tri *Triangle) Intersect(r Ray) (coll Collision)
- func (tri *Triangle) IntersectsBound(bd bound.Bound) bool
- func (tri *Triangle) Material() Material
- func (tri *Triangle) SetMaterial(mat Material)
- func (tri *Triangle) SetNormals(a, b, c int)
- func (tri *Triangle) SetUVs(a, b, c int)
- func (tri *Triangle) String() string
- func (tri *Triangle) Surface(coll Collision) (sp SurfacePoint)
- func (tri *Triangle) SurfaceArea() float64
- type UV
- type Vmap
- type VolumeHandler
- type VolumeIntegrator
- type VolumeRegion
- type VolumetricMaterial
Constants ¶
const ( LightTypeDiracDir = 1 << iota // A light with TypeDiracDir has a Dirac delta distribution LightTypeSingular LightTypeNone = 0 )
Light types
Variables ¶
This section is empty.
Functions ¶
func BlockIntegrate ¶
func BlockIntegrate(s *Scene, in Integrator, log log.Logger) <-chan Fragment
BlockIntegrate integrates an image in small batches.
func SimpleIntegrate ¶
func SimpleIntegrate(s *Scene, in Integrator, log log.Logger) <-chan Fragment
SimpleIntegrate integrates an image one pixel at a time.
func WorkerIntegrate ¶
func WorkerIntegrate(s *Scene, in Integrator, log log.Logger) <-chan Fragment
WorkerIntegrate integrates an image using a set number of jobs.
Types ¶
type BSDF ¶
type BSDF uint
BSDF holds bidirectional scattering distribution function flags.
const ( BSDFSpecular BSDF = 1 << iota BSDFGlossy BSDFDiffuse BSDFDispersive BSDFReflect BSDFTransmit BSDFFilter BSDFEmit BSDFVolumetric BSDFNone = 0 BSDFAllSpecular = BSDFSpecular | BSDFReflect | BSDFTransmit BSDFAll = BSDFSpecular | BSDFGlossy | BSDFDiffuse | BSDFDispersive | BSDFReflect | BSDFTransmit | BSDFFilter )
These constants specify material attributes. For more information, see http://en.wikipedia.org/wiki/Bidirectional_scattering_distribution_function
type Background ¶
type Background interface {
// Color returns the background color for a given ray.
Color(r Ray, state *RenderState, filtered bool) color.Color
// Light returns the light source representing background lighting.
// This may be nil if the background should only be sampled from BSDFs.
Light() Light
}
Background is an interface for a rendering background.
type Camera ¶
type Camera interface {
// ShootRay calculates the initial ray used for computing a fragment of the
// output. U and V are sample coordinates that are only calculated if
// SampleLens returns true.
ShootRay(x, y, u, v float64) (Ray, float64)
// ResolutionX returns the number of fragments wide that the camera is.
ResolutionX() int
// ResolutionY returns the number of fragments high that the camera is.
ResolutionY() int
// Project calculates the projection of a ray onto the fragment plane.
Project(wo Ray, lu, lv *float64) (pdf float64, changed bool)
// SampleLens returns whether the lens needs to be sampled using the u and v
// parameters of ShootRay. This is useful for DOF-like effects. When this
// returns false, no lens samples need to be computed.
SampleLens() bool
}
Camera is a viewpoint of a scene.
type ClipPrimitive ¶
type Clipper ¶
type Clipper interface {
// Clip calculates the overlapping bounding box of a given bounding box and the primitive.
// If the bounding box returned is nil, then no such bound exists.
Clip(bound bound.Bound, axis vecutil.Axis, lower bool, oldData interface{}) (clipped bound.Bound, newData interface{})
}
type Collision ¶
Collision stores information about a ray intersection.
func (Collision) Hit ¶
Hit returns whether the ray intersection succeeded. If this method returns false, then the rest of the structure is meaningless.
func (Collision) Surface ¶
func (c Collision) Surface() (sp SurfacePoint)
Surface returns the surface point where the ray intersected.
type DifferentialRay ¶
DifferentialRay stores additional information about a ray for use in surface intersections. For an explanation, see http://www.opticalres.com/white%20papers/DifferentialRayTracing.pdf
func (DifferentialRay) String ¶
func (r DifferentialRay) String() string
type Differentials ¶
type Differentials struct {
X, Y vec64.Vector
Point SurfacePoint
}
Differentials computes and stores data for surface intersections for differential rays. For more information, see http://www.opticalres.com/white%20papers/DifferentialRayTracing.pdf
func NewDifferentials ¶
func NewDifferentials(p SurfacePoint, r *DifferentialRay) Differentials
NewDifferentials creates a new Differentials struct.
func (Differentials) ProjectedPixelArea ¶
func (d Differentials) ProjectedPixelArea() float64
func (Differentials) ReflectRay ¶
func (d Differentials) ReflectRay(in, out *DifferentialRay)
ReflectRay computes differentials for a scattered ray. For an explanation, see: http://en.wikipedia.org/wiki/Specular_reflection
func (Differentials) RefractRay ¶
func (d Differentials) RefractRay(in, out *DifferentialRay, ior float64)
RefractRay computes differentials for a scattered ray. For an explanation, see: http://en.wikipedia.org/wiki/Snell's_law#Vector_form
type DiracLight ¶
type EmitMaterial ¶
type EmitMaterial interface {
Material
// Emit returns the amount of light to contribute.
Emit(state *RenderState, sp SurfacePoint, wo vec64.Vector) color.Color
}
EmitMaterial defines a material that contributes light to the scene.
type Fragment ¶
type Fragment struct {
Color color_.AlphaColor
X, Y int
}
Fragment stores a single element of an image.
func RenderPixel ¶
func RenderPixel(s *Scene, i Integrator, x, y int) Fragment
RenderPixel creates a fragment for a position in the image.
type GatherResult ¶
type Image ¶
Image stores a two-dimensional array of colors. It implements the image.Image interface, so you can use it directly with the standard library.
func NewGoImage ¶
NewGoImage creates a new image based on an image from the standard Go library.