Documentation
¶
Index ¶
- Constants
- func ContextWavelengthsNM(ctx WavelengthContext) []float64
- func SpectralRayToScalar(ray *Ray) float64
- func SpectralSampleRadiance(power, pdf float64) float64
- func SrgbChannelToLinear(v float64) float64
- func UniformWavelengthPDF() float64
- func XYZToLinearSRGB(x, y, z float64) (float64, float64, float64)
- type ACEScg
- type Color3
- func (c Color3) Add(other Color3) Color3
- func (c Color3) At(i int) float64
- func (c Color3) Average() float64
- func (c Color3) B() float64
- func (c Color3) ClampMin(minValue float64) Color3
- func (c Color3) DivScalar(v float64) Color3
- func (c Color3) G() float64
- func (c Color3) IsFinite() bool
- func (c Color3) IsNonNegative() bool
- func (c Color3) IsZero() bool
- func (c Color3) Max() float64
- func (c Color3) Mul(other Color3) Color3
- func (c Color3) MulScalar(v float64) Color3
- func (c Color3) R() float64
- type PathState
- type RGB
- type RGBColorSpace
- type Ray
- func (r *Ray) ConvertToMonochrome()
- func (r *Ray) DisableSpectralSampling()
- func (r *Ray) G() geometry.Geometry
- func (r *Ray) Init()
- func (r *Ray) SampleWavelength(sample float64)
- func (r *Ray) SetMonochrome(wavelength float64)
- func (r *Ray) SetSpectralSample(sample WavelengthSample)
- func (r *Ray) SetSpectralWavelength(wavelength float64)
- type SpectralParameter
- type Spectrum
- func ConstantSpectrum(v float64) Spectrum
- func NewRGBSpectrum(r, g, b float64) Spectrum
- func NewSampledSpectrum(samples []float64) Spectrum
- func NewSpectralPower(power float64) Spectrum
- func NewSpectrum(r, g, b float64) Spectrum
- func SampledSpectrumToLinearSRGB(wavelengthsNM, values []float64) Spectrum
- func (s Spectrum) Add(other Spectrum) Spectrum
- func (s Spectrum) AlmostEqual(other Spectrum, eps float64) bool
- func (s Spectrum) Average() float64
- func (s Spectrum) AverageRGB() float64
- func (s Spectrum) Clone() Spectrum
- func (s Spectrum) DivScalar(v float64) Spectrum
- func (s Spectrum) HasSamples() bool
- func (s Spectrum) IsFinite() bool
- func (s Spectrum) IsNonNegative() bool
- func (s Spectrum) IsZero() bool
- func (s Spectrum) MaxComponent() float64
- func (s Spectrum) Mul(other Spectrum) Spectrum
- func (s Spectrum) MulScalar(v float64) Spectrum
- func (s Spectrum) PowerAt(wavelengthNM float64) (float64, bool)
- func (s Spectrum) RGBChannel(i int) float64
- func (s Spectrum) RGBPowerAtWavelength(wavelengthNM float64) float64
- func (s Spectrum) RGBReflectancePowerAt(wavelengthNM float64) float64
- func (s Spectrum) Sample(i int) float64
- func (s Spectrum) SampleCount() int
- func (s Spectrum) UpliftRGBReflectanceToSampled(wavelengthsNM []float64) Spectrum
- func (s Spectrum) UpliftRGBToSampled(wavelengthsNM []float64) Spectrum
- type SpectrumBounds
- type SpectrumKind
- type UniformWavelengthSampler
- type WavelengthBatchContext
- type WavelengthContext
- type WavelengthSample
- type WavelengthSampler
- type WavelengthWeightFunc
- type WeightedWavelengthSampler
- func NewCIESensitivityWavelengthSampler(bins int) WeightedWavelengthSampler
- func NewCompositeWavelengthSampler(bins int, weights ...WavelengthWeightFunc) WeightedWavelengthSampler
- func NewRGBImportanceWavelengthSampler(rgb Spectrum, bins int) WeightedWavelengthSampler
- func NewWeightedWavelengthSampler(minNM, maxNM float64, bins int, weight WavelengthWeightFunc) WeightedWavelengthSampler
- type XYZ
Constants ¶
const ( WavelengthMin = 380.0 WavelengthMax = 750.0 )
Variables ¶
This section is empty.
Functions ¶
func ContextWavelengthsNM ¶
func ContextWavelengthsNM(ctx WavelengthContext) []float64
func SpectralRayToScalar ¶
func SpectralSampleRadiance ¶
func SrgbChannelToLinear ¶
func UniformWavelengthPDF ¶
func UniformWavelengthPDF() float64
Types ¶
type PathState ¶
type PathState struct {
Throughput float64 `json:"throughput"`
Radiance float64 `json:"radiance"`
Wavelength *WavelengthSample `json:"wavelength,omitempty"`
}
PathState carries scalar power at exactly one sampled wavelength. Authored RGB never enters this state; materials resolve it through SpectralParameter before transport updates Throughput or Radiance.
type RGBColorSpace ¶
type RGBColorSpace string
const ( RGBColorSpaceLinearSRGB RGBColorSpace = "linear_srgb" RGBColorSpaceSRGB RGBColorSpace = "srgb" RGBColorSpaceACEScg RGBColorSpace = "acescg" )
type Ray ¶
type Ray struct {
Origin *mat.VecDense `json:"origin"`
Direction *mat.VecDense `json:"direction"`
Path PathState `json:"path"`
MediumStack medium.Stack `json:"-"`
Space geometry.SceneSpace `json:"-"`
ArcTraveled float64 `json:"-"` // geodesic arc length traveled so far (S^3 wrap)
}
func (*Ray) ConvertToMonochrome ¶
func (r *Ray) ConvertToMonochrome()
func (*Ray) DisableSpectralSampling ¶
func (r *Ray) DisableSpectralSampling()
func (*Ray) SampleWavelength ¶
func (*Ray) SetMonochrome ¶
func (*Ray) SetSpectralSample ¶
func (r *Ray) SetSpectralSample(sample WavelengthSample)
func (*Ray) SetSpectralWavelength ¶
type SpectralParameter ¶
type SpectralParameter interface {
Eval(ctx WavelengthContext) Spectrum
Bounds() SpectrumBounds
}
type Spectrum ¶
type Spectrum struct {
Kind SpectrumKind
RGB RGB
Power float64
Samples []float64
}
Spectrum is a transient material-evaluation value, not transport-path state. Authored RGB is scene-linear sRGB. Transport paths resolve it to an inline scalar at their selected wavelength; sampled vectors are for batched/offline parameter evaluation and intentionally do not mirror RGB channels.
func ConstantSpectrum ¶
func NewRGBSpectrum ¶
func NewSampledSpectrum ¶
func NewSpectralPower ¶
func NewSpectrum ¶
func (Spectrum) AverageRGB ¶
func (Spectrum) HasSamples ¶
func (Spectrum) IsNonNegative ¶
func (Spectrum) MaxComponent ¶
func (Spectrum) PowerAt ¶
PowerAt resolves a renderer value to one scalar spectral power sample. Authored RGB is uplifted only at this boundary; multi-sample values cannot be collapsed without an explicit wavelength-to-index association.
func (Spectrum) RGBChannel ¶
func (Spectrum) RGBPowerAtWavelength ¶
func (Spectrum) RGBReflectancePowerAt ¶
func (Spectrum) SampleCount ¶
func (Spectrum) UpliftRGBReflectanceToSampled ¶
func (Spectrum) UpliftRGBToSampled ¶
type SpectrumBounds ¶
type SpectrumKind ¶
type SpectrumKind int
const ( SpectrumKindRGB SpectrumKind = iota SpectrumKindScalar SpectrumKindSampled )
type UniformWavelengthSampler ¶
func NewUniformWavelengthSampler ¶
func NewUniformWavelengthSampler() UniformWavelengthSampler
func (UniformWavelengthSampler) Sample ¶
func (s UniformWavelengthSampler) Sample(u float64) WavelengthSample
type WavelengthBatchContext ¶
type WavelengthBatchContext interface {
SpectralWavelengthsNM() []float64
}
WavelengthBatchContext is an optional extension for explicit batched/offline parameter evaluation. Runtime transport contexts intentionally do not implement it because one path owns exactly one wavelength.
type WavelengthContext ¶
type WavelengthContext interface {
SpectralWavelengthNM() float64
}
type WavelengthSample ¶
type WavelengthSampler ¶
type WavelengthSampler interface {
Sample(u float64) WavelengthSample
}
type WavelengthWeightFunc ¶
type WeightedWavelengthSampler ¶
type WeightedWavelengthSampler struct {
MinNM float64 // Lower wavelength bound in nanometers.
MaxNM float64 // Upper wavelength bound in nanometers.
Bins int // Number of wavelength intervals.
// contains filtered or unexported fields
}
func NewCIESensitivityWavelengthSampler ¶
func NewCIESensitivityWavelengthSampler(bins int) WeightedWavelengthSampler
func NewCompositeWavelengthSampler ¶
func NewCompositeWavelengthSampler(bins int, weights ...WavelengthWeightFunc) WeightedWavelengthSampler
func NewRGBImportanceWavelengthSampler ¶
func NewRGBImportanceWavelengthSampler(rgb Spectrum, bins int) WeightedWavelengthSampler
func NewWeightedWavelengthSampler ¶
func NewWeightedWavelengthSampler(minNM, maxNM float64, bins int, weight WavelengthWeightFunc) WeightedWavelengthSampler
func (WeightedWavelengthSampler) Sample ¶
func (s WeightedWavelengthSampler) Sample(u float64) WavelengthSample
type XYZ ¶
type XYZ = Color3