rsagl-0.4.0.2: The RogueStar Animation and Graphics Library

Safe HaskellSafe-Infered

RSAGL.Extras.Sky

Description

Generate a realistic sky.

Synopsis

Documentation

type Atmosphere = [AtmosphereLayer]Source

An atmosphere, consisting of zero or more layers of different composition.

type SkyFilter = (Vector3D -> RGB) -> Maybe (RGB -> RGB)Source

An adaptive color filter, used to set adaptive white and black points. Returns Nothing if the result is a constant black.

data AtmosphereComposition Source

A specific scattering model for an AtmosphereLayer

Constructors

Air

Uses Rayleigh scattering, as though an oxygen-nitrogen atmosphere.

Vapor

Uses Mie scattering (approximate) to give an effect similar to what we would expect from some kind of suspended water vapor.

Dust RGB

Macroscopic colored dust spheres.

Fog RGB

Unrealistic colored fog, might be appropriate for some kind of poison gas atmosphere.

data AtmosphereLayer Source

A single layer of atmosphere.

Constructors

AtmosphereLayer 

Fields

atmosphere_composition :: AtmosphereComposition

Represents what substance this layer of atmosphere is made of.

atmosphere_thickness :: RSdouble

Represents the optical thickness of this layer looking straight up. That is, if you reduce the altitude but hold the thickness constant, the layer will be essentially unchanged in the vertical direction. A typical value is 1.0.

atmosphere_altitude :: RSdouble

The altitude to the edge of this atmosphere layer, where 1.0 is the diameter of the planet. Lowering the altitude actually increases the density, and vice-versa, so double or halve the thickness and altitude at the same time. A typical value is 1e-4.

rawSkyFilter :: SkyFilterSource

A SkyFilter that just passes through the raw RGB values, essentially, id.

dynamicSkyFilter :: RSdouble -> RSdouble -> SkyFilterSource

A SkyFilter that takes a maximum black point and a minimum white point, and applies these to black and white points determined by probabalistic means, and then generates a linear filter based on those points. For well chosen parameters this will hopefully produce an appealing sky at any time of day or twilight.

earth_atmosphere :: AtmosphereSource

An atmosphere that is fairly typical of the earth.

atmosphereAbsorbtion :: Atmosphere -> Point3D -> Vector3D -> RGBSource

Aggrigated absorbtion from multiple AtmosphereLayers.

atmosphereScattering :: Atmosphere -> [(Vector3D, RGB)] -> Point3D -> Vector3D -> RGBSource

Aggrigated scattering from multiple AtmosphereLayers and multiple suns.

absorbtionFilter :: RGB -> RGBSource

Takes a filter color and modifies it on a logarithmic scale. Helps when dealing with very dense color filters. In particular, atmosphereScatteringMaterial uses this.

atmosphereScatteringMaterial :: Atmosphere -> [(Vector3D, RGB)] -> SkyFilter -> MaterialM attr ()Source

Generate a material for a sky sphere. This material includes both scattering and absorbtion information. The material assumes the origin as the eye point, tracing to the geometric point at each vertex. Therefore, this material need not be applied to an exact sphere.