Documentation ¶
Index ¶
- Constants
- func ImageFromPixels(pixels []vector.Vec, width int, height int, clamp bool, alpha uint8, ...)
- type Atmosphere
- func (sky *Atmosphere) ComputeAtmosphere(uSampleDomain int, vSampleDomain int) []vector.Vec
- func (sky *Atmosphere) ComputeRegion(uSampleDomain int, vSampleDomain int, x_corner int, y_corner int, width int, ...) []vector.Vec
- func (sky *Atmosphere) CreateEnvBox(width int, height int, clamp bool)
- func (sky *Atmosphere) CreateTexture(width int, height int, clamp bool, filename string)
- func (sky *Atmosphere) InitPosition(absDay float32, inclinationOffset float32) error
- func (sky *Atmosphere) UpdatePosition(delta float32) error
- func (sky *Atmosphere) VolumetricScatterRay(sample vector.Vec, view vector.Vec) vector.Vec
- type Domain
- type EarthCoords
Constants ¶
const ( PI = 3.141529 AXIAL_TILT = 23.5 //Degrees RAYLEIGH_SAMPLES = 25 //RAYLEIGH sampling LIGHT_PATH_SAMPLES = 25 //PATH SAMPLES AU = 150000000 //SUN HM = 1500 //AEROSOL MIE SCATTER HEIGHT HR = 8000 //RAYLEIGH SCATTER HEIGHT )
Atmosphere environment lighting model.
This model generates a sun position based on lat/long and solar times and then we simulate atmospheric scattering processes via Rayleigh/Mie Scattering.
const (
EARTH_RAD = 6370
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Atmosphere ¶
type Atmosphere struct { Light light.Light Spd light.Spectrum Sun polar.Polar //Orbtial Solar System Earth 2 Sun Polar Coordinate Earth *EarthCoords Day float32 Dir vector.Vec //Euclidian Sun Directio }
Atmosphere Environment
func NewAtmosphere ¶
func NewAtmosphere(lat float32, long float32) *Atmosphere
Allocates Default Data Structure and Solar Coords Structs
func (*Atmosphere) ComputeAtmosphere ¶
func (sky *Atmosphere) ComputeAtmosphere(uSampleDomain int, vSampleDomain int) []vector.Vec
Maps texel coordinates to spherical coordinate sampler values (-1,1) and stores resultant map in single texture.
func (*Atmosphere) ComputeRegion ¶
func (sky *Atmosphere) ComputeRegion(uSampleDomain int, vSampleDomain int, x_corner int, y_corner int, width int, height int) []vector.Vec
Maps texel coordinates to spherical coordinate sampler values (-1,1) and stores
func (*Atmosphere) CreateEnvBox ¶
func (sky *Atmosphere) CreateEnvBox(width int, height int, clamp bool)
Creates 6-textures from from computed atmosphere, non-clamping allows for HDR storage width and height are the per texture width height values of the image size
func (*Atmosphere) CreateTexture ¶
func (sky *Atmosphere) CreateTexture(width int, height int, clamp bool, filename string)
Creates texture from from computed atmosphere, non-clamping allows for HDR storage
func (*Atmosphere) InitPosition ¶
func (sky *Atmosphere) InitPosition(absDay float32, inclinationOffset float32) error
Initialize sun positional reference coordinates in terms of polar coordinates
func (*Atmosphere) UpdatePosition ¶
func (sky *Atmosphere) UpdatePosition(delta float32) error
Updates sun positional coordinates by rotating Azimuth & Polar coords by delta degrees
func (*Atmosphere) VolumetricScatterRay ¶
Given a sampling vector and a viewing direction calculate RGB stimulus return Based on the Attenuation/Mie Phase Scatter/RayleighScatter Terms
type EarthCoords ¶
type EarthCoords struct { Latitude float32 //Decimal Lat Longitude float32 //Decimal Long PolarCoord polar.Polar //Polar Axis offset StandardMeridian float32 //Longitude Standard Meridian For Local Time Offsets DomainOffset [2]float32 //Domain offsets for polar sampling of sky depths GreaterSphere polar.Polar //Atmospheric Polar Parameters Polar Parameters }
Earth Coordinates and Greater Earth will not be rotated for simplicity all Polar transformations are added to sun Polar coordinates as negative transforms
func NewEarth ¶
func NewEarth(lat float32, long float32) *EarthCoords
Declare New Sun Environment with Standard Merdian time set for NYC - Sky Functions handle sun rotation
func (*EarthCoords) GetPosition ¶
func (earth *EarthCoords) GetPosition() vector.Vec
func (*EarthCoords) GetRadius ¶
func (earth *EarthCoords) GetRadius() float32
func (*EarthCoords) GetSample ¶
func (earth *EarthCoords) GetSample(uv [2]float32) vector.Vec
Takes clamped [U,V] polar coordinates from [-1,1.0] and returns the ray depth Returns vector with magnitude to fixed point in sky in valid coordinates
func (*EarthCoords) GetSampleDepth ¶
func (earth *EarthCoords) GetSampleDepth(sample vector.Vec) float32
Approximation of sample depth based on Z coordinate