Documentation ¶
Overview ¶
Package material implements the different materials and their properties.
Index ¶
- type Dielectric
- func (d *Dielectric) Albedo(u float64, v float64, p *vec3.Vec3Impl) *vec3.Vec3Impl
- func (d *Dielectric) Emitted(_ ray.Ray, _ *hitrecord.HitRecord, _ float64, _ float64, _ *vec3.Vec3Impl) *vec3.Vec3Impl
- func (d *Dielectric) IsEmitter() bool
- func (np *Dielectric) NormalMap() texture.Texture
- func (d *Dielectric) Scatter(r ray.Ray, hr *hitrecord.HitRecord, random *fastrandom.LCG) (*ray.RayImpl, *scatterrecord.ScatterRecord, bool)
- func (d *Dielectric) ScatteringPDF(r ray.Ray, hr *hitrecord.HitRecord, scattered ray.Ray) float64
- type DiffuseLight
- func (dl *DiffuseLight) Albedo(u float64, v float64, p *vec3.Vec3Impl) *vec3.Vec3Impl
- func (dl *DiffuseLight) Emitted(rIn ray.Ray, rec *hitrecord.HitRecord, u float64, v float64, p *vec3.Vec3Impl) *vec3.Vec3Impl
- func (dl *DiffuseLight) IsEmitter() bool
- func (np *DiffuseLight) NormalMap() texture.Texture
- func (dl *DiffuseLight) Scatter(_ ray.Ray, _ *hitrecord.HitRecord, _ *fastrandom.LCG) (*ray.RayImpl, *scatterrecord.ScatterRecord, bool)
- func (dl *DiffuseLight) ScatteringPDF(r ray.Ray, hr *hitrecord.HitRecord, scattered ray.Ray) float64
- type Isotropic
- func (i *Isotropic) Albedo(u float64, v float64, p *vec3.Vec3Impl) *vec3.Vec3Impl
- func (ne *Isotropic) Emitted(_ ray.Ray, _ *hitrecord.HitRecord, _ float64, _ float64, _ *vec3.Vec3Impl) *vec3.Vec3Impl
- func (ne *Isotropic) IsEmitter() bool
- func (np *Isotropic) NormalMap() texture.Texture
- func (i *Isotropic) Scatter(r ray.Ray, hr *hitrecord.HitRecord, random *fastrandom.LCG) (*ray.RayImpl, *scatterrecord.ScatterRecord, bool)
- func (i *Isotropic) ScatteringPDF(r ray.Ray, hr *hitrecord.HitRecord, scattered ray.Ray) float64
- type Lambertian
- func (l *Lambertian) Albedo(u float64, v float64, p *vec3.Vec3Impl) *vec3.Vec3Impl
- func (ne *Lambertian) Emitted(_ ray.Ray, _ *hitrecord.HitRecord, _ float64, _ float64, _ *vec3.Vec3Impl) *vec3.Vec3Impl
- func (ne *Lambertian) IsEmitter() bool
- func (np *Lambertian) NormalMap() texture.Texture
- func (l *Lambertian) Scatter(r ray.Ray, hr *hitrecord.HitRecord, random *fastrandom.LCG) (*ray.RayImpl, *scatterrecord.ScatterRecord, bool)
- func (l *Lambertian) ScatteringPDF(r ray.Ray, hr *hitrecord.HitRecord, scattered ray.Ray) float64
- type Material
- type Metal
- func (m *Metal) Albedo(u float64, v float64, p *vec3.Vec3Impl) *vec3.Vec3Impl
- func (ne *Metal) Emitted(_ ray.Ray, _ *hitrecord.HitRecord, _ float64, _ float64, _ *vec3.Vec3Impl) *vec3.Vec3Impl
- func (ne *Metal) IsEmitter() bool
- func (np *Metal) NormalMap() texture.Texture
- func (m *Metal) Scatter(r ray.Ray, hr *hitrecord.HitRecord, random *fastrandom.LCG) (*ray.RayImpl, *scatterrecord.ScatterRecord, bool)
- func (m *Metal) ScatteringPDF(r ray.Ray, hr *hitrecord.HitRecord, scattered ray.Ray) float64
- type PBR
- func (pbr *PBR) Albedo(u float64, v float64, p *vec3.Vec3Impl) *vec3.Vec3Impl
- func (ne *PBR) Emitted(_ ray.Ray, _ *hitrecord.HitRecord, _ float64, _ float64, _ *vec3.Vec3Impl) *vec3.Vec3Impl
- func (ne *PBR) IsEmitter() bool
- func (pbr *PBR) NormalMap() texture.Texture
- func (pbr *PBR) Scatter(r ray.Ray, hr *hitrecord.HitRecord, random *fastrandom.LCG) (*ray.RayImpl, *scatterrecord.ScatterRecord, bool)
- func (pbr *PBR) ScatteringPDF(r ray.Ray, hr *hitrecord.HitRecord, scattered ray.Ray) float64
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Dielectric ¶
type Dielectric struct {
// contains filtered or unexported fields
}
Dielectric represents a dielectric material.
func NewDielectric ¶
func NewDielectric(reIdx float64) *Dielectric
NewDielectric returns an instance of a dielectric material.
func (*Dielectric) IsEmitter ¶
func (d *Dielectric) IsEmitter() bool
IsEmitter() is true for dielectric materials as they reflect light and can be considered emitters.
func (*Dielectric) Scatter ¶
func (d *Dielectric) Scatter(r ray.Ray, hr *hitrecord.HitRecord, random *fastrandom.LCG) (*ray.RayImpl, *scatterrecord.ScatterRecord, bool)
Scatter computes how the ray bounces off the surface of a dielectric material.
func (*Dielectric) ScatteringPDF ¶
ScatteringPDF implements the probability distribution function for dielectric materials.
type DiffuseLight ¶
type DiffuseLight struct {
// contains filtered or unexported fields
}
DiffuseLight represents a diffuse light material.
func NewDiffuseLight ¶
func NewDiffuseLight(emit texture.Texture) *DiffuseLight
NewDiffuseLight returns an instance of a diffuse light.
func (*DiffuseLight) Emitted ¶
func (dl *DiffuseLight) Emitted(rIn ray.Ray, rec *hitrecord.HitRecord, u float64, v float64, p *vec3.Vec3Impl) *vec3.Vec3Impl
Emitted returns the texture value at that point.
func (*DiffuseLight) IsEmitter ¶
func (dl *DiffuseLight) IsEmitter() bool
func (*DiffuseLight) Scatter ¶
func (dl *DiffuseLight) Scatter(_ ray.Ray, _ *hitrecord.HitRecord, _ *fastrandom.LCG) (*ray.RayImpl, *scatterrecord.ScatterRecord, bool)
Scatter returns false for diffuse light materials.
func (*DiffuseLight) ScatteringPDF ¶
func (dl *DiffuseLight) ScatteringPDF(r ray.Ray, hr *hitrecord.HitRecord, scattered ray.Ray) float64
ScatteringPDF implements the probability distribution function for diffuse lights.
type Isotropic ¶
type Isotropic struct {
// contains filtered or unexported fields
}
Isotropic represents an isotropic material.
func NewIsotropic ¶
NewIsotropic returns a new instances of the isotropic material.
func (*Isotropic) Emitted ¶
func (ne *Isotropic) Emitted(_ ray.Ray, _ *hitrecord.HitRecord, _ float64, _ float64, _ *vec3.Vec3Impl) *vec3.Vec3Impl
Emitted returns black for non-emitter materials.
func (*Isotropic) Scatter ¶
func (i *Isotropic) Scatter(r ray.Ray, hr *hitrecord.HitRecord, random *fastrandom.LCG) (*ray.RayImpl, *scatterrecord.ScatterRecord, bool)
Scatter computes how the ray bounces off the surface of a diffuse material.
type Lambertian ¶
type Lambertian struct {
// contains filtered or unexported fields
}
Lambertian represents a diffuse material.
func NewLambertian ¶
func NewLambertian(albedo texture.Texture) *Lambertian
NewLambertian returns an instance of the Lambert material.
func (*Lambertian) Emitted ¶
func (ne *Lambertian) Emitted(_ ray.Ray, _ *hitrecord.HitRecord, _ float64, _ float64, _ *vec3.Vec3Impl) *vec3.Vec3Impl
Emitted returns black for non-emitter materials.
func (*Lambertian) Scatter ¶
func (l *Lambertian) Scatter(r ray.Ray, hr *hitrecord.HitRecord, random *fastrandom.LCG) (*ray.RayImpl, *scatterrecord.ScatterRecord, bool)
Scatter computes how the ray bounces off the surface of a diffuse material.
func (*Lambertian) ScatteringPDF ¶
ScatteringPDF implements the probability distribution function for diffuse materials.
type Material ¶
type Material interface { Scatter(r ray.Ray, hr *hitrecord.HitRecord, random *fastrandom.LCG) (*ray.RayImpl, *scatterrecord.ScatterRecord, bool) NormalMap() texture.Texture Albedo(u float64, v float64, p *vec3.Vec3Impl) *vec3.Vec3Impl ScatteringPDF(r ray.Ray, hr *hitrecord.HitRecord, scattered ray.Ray) float64 IsEmitter() bool Emitted(rIn ray.Ray, rec *hitrecord.HitRecord, u float64, v float64, p *vec3.Vec3Impl) *vec3.Vec3Impl }
Material defines the methods to handle materials.
type Metal ¶
type Metal struct {
// contains filtered or unexported fields
}
Metal represents metallic materials.
func (*Metal) Emitted ¶
func (ne *Metal) Emitted(_ ray.Ray, _ *hitrecord.HitRecord, _ float64, _ float64, _ *vec3.Vec3Impl) *vec3.Vec3Impl
Emitted returns black for non-emitter materials.
func (*Metal) Scatter ¶
func (m *Metal) Scatter(r ray.Ray, hr *hitrecord.HitRecord, random *fastrandom.LCG) (*ray.RayImpl, *scatterrecord.ScatterRecord, bool)
Scatter computes how the ray bounces off the surface of a metallic object.
type PBR ¶
type PBR struct {
// contains filtered or unexported fields
}
func (*PBR) Emitted ¶
func (ne *PBR) Emitted(_ ray.Ray, _ *hitrecord.HitRecord, _ float64, _ float64, _ *vec3.Vec3Impl) *vec3.Vec3Impl
Emitted returns black for non-emitter materials.
func (*PBR) Scatter ¶
func (pbr *PBR) Scatter(r ray.Ray, hr *hitrecord.HitRecord, random *fastrandom.LCG) (*ray.RayImpl, *scatterrecord.ScatterRecord, bool)
Scatter computes how the ray bounces off the surface of a PBR material.