Documentation ¶
Index ¶
- Constants
- func RGBToXYZ(rgb [3]float32) [3]float32
- func SunlightSpectrum(nm float64) float64
- func SunlightSpectrumAttenuate(nm float64, k_atten float64) float64
- func XYZToRGB(xyz [3]float32) [3]float32
- type Area
- func (p Area) GetDir() vector.Vec
- func (p Area) GetFlux() float32
- func (p Area) GetRGB() vector.Vec
- func (p Area) Lx() *Source
- func (p Area) Position() vector.Vec
- func (p Area) SetDir(a vector.Vec)
- func (p Area) SetFlux(a float32)
- func (p Area) SetPos(a vector.Vec)
- func (p Area) SetRGB(a vector.Vec)
- func (p Area) Type() int
- type Attenuated
- func (p Attenuated) GetDir() vector.Vec
- func (p Attenuated) GetFlux() float32
- func (p Attenuated) GetRGB() vector.Vec
- func (p Attenuated) Lx() *Source
- func (p Attenuated) Position() vector.Vec
- func (p Attenuated) SetDir(a vector.Vec)
- func (p Attenuated) SetFlux(a float32)
- func (p Attenuated) SetPos(a vector.Vec)
- func (p Attenuated) SetRGB(a vector.Vec)
- func (p Attenuated) Type() int
- type CoefficientSpectrum
- func (ref *CoefficientSpectrum) Add(m Spectrum) Spectrum
- func (ref *CoefficientSpectrum) Clamp(low float32, high float32) Spectrum
- func (ref *CoefficientSpectrum) Div(m Spectrum) Spectrum
- func (ref *CoefficientSpectrum) InitSpectrum(steps int, total_power float32) Spectrum
- func (ref *CoefficientSpectrum) IsBlack() bool
- func (ref *CoefficientSpectrum) IsNaN() bool
- func (ref *CoefficientSpectrum) IsWatts() bool
- func (ref *CoefficientSpectrum) Lerp(m Spectrum, t float32) Spectrum
- func (ref *CoefficientSpectrum) Mul(m Spectrum) Spectrum
- func (ref *CoefficientSpectrum) Neg() Spectrum
- func (ref *CoefficientSpectrum) Pow(k float32) Spectrum
- func (ref *CoefficientSpectrum) Sample(n int) float32
- func (ref *CoefficientSpectrum) Set(index int, value float32)
- func (ref *CoefficientSpectrum) Sqrt() Spectrum
- func (ref *CoefficientSpectrum) Sub(m Spectrum) Spectrum
- func (ref *CoefficientSpectrum) Units() int
- func (ref *CoefficientSpectrum) Wavelength(n int) float32
- func (ref *CoefficientSpectrum) WriteJSON(filename string, name string, id int)
- type CylinderLight
- type Directional
- func (p Directional) GetDir() vector.Vec
- func (p Directional) GetFlux() float32
- func (p Directional) GetRGB() vector.Vec
- func (p Directional) Lx() *Source
- func (p Directional) Position() vector.Vec
- func (p Directional) SetDir(a vector.Vec)
- func (p Directional) SetFlux(a float32)
- func (p Directional) SetPos(a vector.Vec)
- func (p Directional) SetRGB(a vector.Vec)
- func (p Directional) Type() int
- type DiscLight
- type Light
- type LightIntegral
- type Probe
- type RectLight
- type SampledSpectrum
- func (ref *SampledSpectrum) Add_CIEX(spd_ciex *CoefficientSpectrum)
- func (ref *SampledSpectrum) Add_CIEY(spd_ciey *CoefficientSpectrum)
- func (ref *SampledSpectrum) Add_CIEZ(spd_ciez *CoefficientSpectrum)
- func (ref *SampledSpectrum) FromFile(file string) error
- func (ref *SampledSpectrum) FromSampled(wv []float32, v []float32) error
- func (ref *SampledSpectrum) ToRGB() [3]float32
- func (ref *SampledSpectrum) ToXYZ() [3]float32
- func (ref *SampledSpectrum) WriteJSON(filename string, name string, id int)
- func (ref *SampledSpectrum) YY() float32
- type Source
- type Spectrum
Constants ¶
const ( ATTENUATED_LIGHT = 1 DIRECTIONAL_LIGHT = 2 AREA_LIGHT = 3 WATTS = 0 // Default unit LUMENS = 1 )
const ( SP_VIOLET = 380.0 SP_RED = 625.0 WATT = 0 LUX = 1 )
const ( SPD_B = 9.6 SPD_C = 3.1 SPD_K = 1.68 SPD_G = 0.45 )
Sunlight Distribution Variables
Variables ¶
This section is empty.
Functions ¶
func SunlightSpectrum ¶
------------INLINE FUNCTIONS FOR RETURNING SUN COEFFICIENT SPECTRUM---------
func SunlightSpectrumAttenuate ¶
SPD Burr Sunlight Distribution Model Attenuated by k_atten factor
Types ¶
type Area ¶
Area lights are attenuated lights with a restrictive projected solid angle. For a point to recieve light it must be encapsulate by the projecting solid angle. Lux is taken to a total output across this solid angle max
type Attenuated ¶
Attenuated lights cast a total luminance across a unit sphere which amounts inverse squared attenuation factor given the total luminal output in lux. Attenuated lights are synonymous with point lights.
func (Attenuated) GetDir ¶
func (p Attenuated) GetDir() vector.Vec
func (Attenuated) GetFlux ¶
func (p Attenuated) GetFlux() float32
func (Attenuated) GetRGB ¶
func (p Attenuated) GetRGB() vector.Vec
func (Attenuated) Lx ¶
func (p Attenuated) Lx() *Source
func (Attenuated) Position ¶
func (p Attenuated) Position() vector.Vec
func (Attenuated) SetDir ¶
func (p Attenuated) SetDir(a vector.Vec)
func (Attenuated) SetFlux ¶
func (p Attenuated) SetFlux(a float32)
func (Attenuated) SetPos ¶
func (p Attenuated) SetPos(a vector.Vec)
func (Attenuated) SetRGB ¶
func (p Attenuated) SetRGB(a vector.Vec)
func (Attenuated) Type ¶
func (p Attenuated) Type() int
type CoefficientSpectrum ¶
type CoefficientSpectrum struct { Samples []float32 Type int Wv_a float32 //Wavelength start violet Wv_b float32 //Wavelngth end red }
Coefficient Spectrum
func (*CoefficientSpectrum) Add ¶
func (ref *CoefficientSpectrum) Add(m Spectrum) Spectrum
Adds to samples together no error checking out of bounds responsible for caller
func (*CoefficientSpectrum) Clamp ¶
func (ref *CoefficientSpectrum) Clamp(low float32, high float32) Spectrum
func (*CoefficientSpectrum) Div ¶
func (ref *CoefficientSpectrum) Div(m Spectrum) Spectrum
Divides samples together no error checking out of bounds responsible for caller
func (*CoefficientSpectrum) InitSpectrum ¶
func (ref *CoefficientSpectrum) InitSpectrum(steps int, total_power float32) Spectrum
------------------Coefficient Spectrum--------------------------------------
func (*CoefficientSpectrum) IsBlack ¶
func (ref *CoefficientSpectrum) IsBlack() bool
func (*CoefficientSpectrum) IsNaN ¶
func (ref *CoefficientSpectrum) IsNaN() bool
func (*CoefficientSpectrum) IsWatts ¶
func (ref *CoefficientSpectrum) IsWatts() bool
func (*CoefficientSpectrum) Lerp ¶
func (ref *CoefficientSpectrum) Lerp(m Spectrum, t float32) Spectrum
func (*CoefficientSpectrum) Mul ¶
func (ref *CoefficientSpectrum) Mul(m Spectrum) Spectrum
Multiplies samples together no error checking out of bounds responsible for caller
func (*CoefficientSpectrum) Neg ¶
func (ref *CoefficientSpectrum) Neg() Spectrum
func (*CoefficientSpectrum) Pow ¶
func (ref *CoefficientSpectrum) Pow(k float32) Spectrum
func (*CoefficientSpectrum) Sample ¶
func (ref *CoefficientSpectrum) Sample(n int) float32
Gets the Sampler Photon from sampler slice
func (*CoefficientSpectrum) Set ¶
func (ref *CoefficientSpectrum) Set(index int, value float32)
Sets sampler coefficient
func (*CoefficientSpectrum) Sqrt ¶
func (ref *CoefficientSpectrum) Sqrt() Spectrum
func (*CoefficientSpectrum) Sub ¶
func (ref *CoefficientSpectrum) Sub(m Spectrum) Spectrum
Subs samples together no error checking out of bounds responsible for caller
func (*CoefficientSpectrum) Units ¶
func (ref *CoefficientSpectrum) Units() int
func (*CoefficientSpectrum) Wavelength ¶
func (ref *CoefficientSpectrum) Wavelength(n int) float32
Gets the Sampler Photon from sampler slice
type CylinderLight ¶
type CylinderLight struct { SampleLx *Area Luminance float32 //Total output Pos vector.Vec Axis vector.Vec Length float32 }
Cylindrical lights are simply a line of oriented attenuated lights
type Directional ¶
Directional lights are infinite lights with apparent-non local divergence for ray paths. Typically position is not a factor for directional lights but we may model occlusions etc with a position
func (Directional) GetDir ¶
func (p Directional) GetDir() vector.Vec
func (Directional) GetFlux ¶
func (p Directional) GetFlux() float32
func (Directional) GetRGB ¶
func (p Directional) GetRGB() vector.Vec
func (Directional) Lx ¶
func (p Directional) Lx() *Source
func (Directional) Position ¶
func (p Directional) Position() vector.Vec
func (Directional) SetDir ¶
func (p Directional) SetDir(a vector.Vec)
func (Directional) SetFlux ¶
func (p Directional) SetFlux(a float32)
func (Directional) SetPos ¶
func (p Directional) SetPos(a vector.Vec)
func (Directional) SetRGB ¶
func (p Directional) SetRGB(a vector.Vec)
func (Directional) Type ¶
func (p Directional) Type() int
type LightIntegral ¶
type LightIntegral interface { Lights() []Light Luminance(point vector.Vec) float32 Position() vector.Vec }
Approximates area light for contributions.
type RectLight ¶
type RectLight struct { SampleLx *Area Lum float32 //Total output Pos vector.Vec Width float32 Height float32 Num_w float32 Num_h float32 EdgeCutoff float32 Plane []vector.Vec //Triangle plane represents object }
Rect lights sample the light boundaries luminance is distributed across the planar region. Lights can be handled as virtual area lights with 180 cutoff becaues the output energy is distributed evenly by the area the normal light point vectors estimate the contribution while output is conserved.
func NewRectLight ¶
func (*RectLight) Lights ¶
Area light is defined by a planar orientation given by the planar matrix This calculates all light positions and returns an array for the given light
type SampledSpectrum ¶
type SampledSpectrum struct { SPD Spectrum Samples int CoefficientSpectrum CoefficientSpectrum // contains filtered or unexported fields }
Sampled Spectrum holds an SPD and references to CIE XYZ sampled Spectrums cieX , cieY, cieZ should be references only.
func InitSampledSpectrum ¶
func InitSampledSpectrum(v float32, n float32) *SampledSpectrum
-----------------------Sampled Spectrum------------------------------------ Returns Sampled spectrum with default constructions - returns nil for invalid
func (*SampledSpectrum) Add_CIEX ¶
func (ref *SampledSpectrum) Add_CIEX(spd_ciex *CoefficientSpectrum)
Allocates CIEX infrastructre
func (*SampledSpectrum) Add_CIEY ¶
func (ref *SampledSpectrum) Add_CIEY(spd_ciey *CoefficientSpectrum)
Allocates CIEY infrastructre
func (*SampledSpectrum) Add_CIEZ ¶
func (ref *SampledSpectrum) Add_CIEZ(spd_ciez *CoefficientSpectrum)
Allocates CIEZ infrastructure
func (*SampledSpectrum) FromFile ¶
func (ref *SampledSpectrum) FromFile(file string) error
Imports SPD into currently allocated Sampled Spectrum Type
func (*SampledSpectrum) FromSampled ¶
func (ref *SampledSpectrum) FromSampled(wv []float32, v []float32) error
We assume that the sample arrays are sorted - returns error if we can detect an unordered sample sapce or the data sets arent correlated
func (*SampledSpectrum) ToRGB ¶
func (ref *SampledSpectrum) ToRGB() [3]float32
func (*SampledSpectrum) ToXYZ ¶
func (ref *SampledSpectrum) ToXYZ() [3]float32
Returns SPD in form of device independent XYZ color coordinates
func (*SampledSpectrum) WriteJSON ¶
func (ref *SampledSpectrum) WriteJSON(filename string, name string, id int)
JSON Writing
func (*SampledSpectrum) YY ¶
func (ref *SampledSpectrum) YY() float32
type Source ¶
Source - Luminous Flux and Light Color in RGB Color Space. Systems dependent on physical light interaction such as absorption, scattering should use light.SPD Units are either based in Watts or Lumens per meter area
type Spectrum ¶
type Spectrum interface { InitSpectrum(samples int, total_power float32) Spectrum Sample(n int) float32 Set(index int, value float32) Wavelength(n int) float32 Units() int IsWatts() bool IsBlack() bool IsNaN() bool Add(Spectrum) Spectrum Mul(Spectrum) Spectrum Div(Spectrum) Spectrum Sub(Spectrum) Spectrum Neg() Spectrum Sqrt() Spectrum Lerp(Spectrum, float32) Spectrum Pow(k float32) Spectrum Clamp(low float32, high float32) Spectrum WriteJSON(filename string, name string, id int) }
func InitSunlight ¶
------------------Coefficient Spectrum--------------------------------