Blender V2.61 - r43446
Classes | Defines | Typedefs | Functions

sunsky.h File Reference

Go to the source code of this file.

Classes

struct  SunSky

Defines

#define SPECTRUM_MAX_COMPONENTS   100
#define SPECTRUM_START   350.0
#define SPECTRUM_END   800.0

Typedefs

typedef struct SunSky SunSky

Functions

void InitSunSky (struct SunSky *sunsky, float turb, float *toSun, float horizon_brightness, float spread, float sun_brightness, float sun_size, float back_scatter, float skyblendfac, short skyblendtype, float sky_exposure, float sky_colorspace)
void GetSkyXYZRadiance (struct SunSky *sunsky, float theta, float phi, float color_out[3])
void GetSkyXYZRadiancef (struct SunSky *sunsky, const float varg[3], float color_out[3])
void InitAtmosphere (struct SunSky *sunSky, float sun_intens, float mief, float rayf, float inscattf, float extincf, float disf)
void AtmospherePixleShader (struct SunSky *sunSky, float view[3], float s, float rgb[3])
void ClipColor (float c[3])

Detailed Description

Definition in file sunsky.h.


Define Documentation

#define SPECTRUM_END   800.0

Definition at line 37 of file sunsky.h.

#define SPECTRUM_MAX_COMPONENTS   100

This feature comes from Preetham paper on "A Practical Analytic Model for Daylight" and example code from Brian Smits, another author of that paper in http://www.cs.utah.edu/vissim/papers/sunsky/code/

Definition at line 35 of file sunsky.h.

#define SPECTRUM_START   350.0

Definition at line 36 of file sunsky.h.


Typedef Documentation

typedef struct SunSky SunSky

Function Documentation

void AtmospherePixleShader ( struct SunSky sunSky,
float  view[3],
float  s,
float  rgb[3] 
)

AtmospherePixleShader: this function apply atmosphere effect on a pixle color `rgb' at distance `s' parameters: sunSky, contains information about sun parameters and user values view, is camera view vector s, is distance rgb, contains rendered color value for a pixle

Definition at line 432 of file sunsky.c.

References SunSky::atm_BetaDashMie, SunSky::atm_BetaDashRay, SunSky::atm_BetaMie, SunSky::atm_BetaMieMultiplier, SunSky::atm_BetaRay, SunSky::atm_BetaRayMultiplier, SunSky::atm_BetaRM, SunSky::atm_DistanceMultiplier, SunSky::atm_ExtinctionMultiplier, SunSky::atm_HGg, SunSky::atm_InscatteringMultiplier, SunSky::atm_SunIntensity, ComputeAttenuatedSunlight(), copy_v3_v3(), dot_v3v3(), KDL::exp(), fopvec3, I, M_LN2, sqrtf, SunSky::theta, SunSky::toSun, SunSky::turbidity, vec3opf, and vec3opv.

Referenced by shadeAtmPixel().

void ClipColor ( float  c[3])

ClipColor: clip a color to range [0,1];

Definition at line 69 of file sunsky.c.

void GetSkyXYZRadiance ( struct SunSky sunsky,
float  theta,
float  phi,
float  color_out[3] 
)

GetSkyXYZRadiance: this function compute sky radiance according to a view parameters `theta' and `phi'and sunSky values parameters: sunSky, sontains sun and sky parameters theta, is sun's theta phi, is sun's phi color_out, is computed color that shows sky radiance in XYZ color format

Definition at line 244 of file sunsky.c.

References AngleBetween(), KDL::exp(), M_1_PI, M_PI, SunSky::perez_x, SunSky::perez_Y, SunSky::perez_y, PerezFunction(), SunSky::phi, SunSky::sky_exposure, SunSky::theta, X, SunSky::zenith_x, SunSky::zenith_y, and SunSky::zenith_Y.

Referenced by GetSkyXYZRadiancef().

void GetSkyXYZRadiancef ( struct SunSky sunsky,
const float  varg[3],
float  color_out[3] 
)

GetSkyXYZRadiancef: this function compute sky radiance according to a view direction `varg' and sunSky values parameters: sunSky, sontains sun and sky parameters varg, shows direction color_out, is computed color that shows sky radiance in XYZ color format

Definition at line 291 of file sunsky.c.

References copy_v3_v3(), DirectionToThetaPhi(), GetSkyXYZRadiance(), and normalize_v3().

Referenced by shadeSunView().

void InitAtmosphere ( struct SunSky sunSky,
float  sun_intens,
float  mief,
float  rayf,
float  inscattf,
float  extincf,
float  disf 
)

InitAtmosphere: this function intiate sunSky structure with user input parameters. parameters: sunSky, contains information about sun, and in this function some atmosphere parameters will initiated sun_intens, shows sun intensity value mief, Mie scattering factor this factor currently call with 1.0 rayf, Rayleigh scattering factor, this factor currently call with 1.0 inscattf, inscatter light factor that range from 0.0 to 1.0, 0.0 means no inscatter light and 1.0 means full inscatter light extincf, extinction light factor that range from 0.0 to 1.0, 0.0 means no extinction and 1.0 means full extinction disf, is distance factor, multiplyed to pixle's z value to compute each pixle's distance to camera,

Definition at line 358 of file sunsky.c.

References SunSky::atm_BetaDashMie, SunSky::atm_BetaDashRay, SunSky::atm_BetaMie, SunSky::atm_BetaMieMultiplier, SunSky::atm_BetaRay, SunSky::atm_BetaRayMultiplier, SunSky::atm_DistanceMultiplier, SunSky::atm_ExtinctionMultiplier, SunSky::atm_HGg, SunSky::atm_InscatteringMultiplier, SunSky::atm_SunIntensity, credits_svn_gen::e, i, K, N, T, vec3opf, and vec3opv.

Referenced by add_render_lamp().

void InitSunSky ( struct SunSky sunsky,
float  turb,
float *  toSun,
float  horizon_brightness,
float  spread,
float  sun_brightness,
float  sun_size,
float  back_scatter,
float  skyblendfac,
short  skyblendtype,
float  sky_exposure,
float  sky_colorspace 
)

InitSunSky: this function compute some sun,sky parameters according to input parameters and also initiate some other sun, sky parameters parameters: sunSky, is a structure that contains informtion about sun, sky and atmosphere, in this function, most of its values initiated turb, is atmosphere turbidity toSun, contains sun direction horizon_brighness, controls the brightness of the horizon colors spread, controls colors spreed at horizon sun_brightness, controls sun's brightness sun_size, controls sun's size back_scatter, controls back scatter light

Definition at line 141 of file sunsky.c.

References SunSky::backscattered_light, DirectionToThetaPhi(), credits_svn_gen::e, SunSky::horizon_brightness, M_PI, SunSky::perez_x, SunSky::perez_y, SunSky::perez_Y, SunSky::phi, SunSky::sky_colorspace, SunSky::sky_exposure, SunSky::skyblendfac, SunSky::skyblendtype, SunSky::spread, SunSky::sun_brightness, SunSky::sun_size, SunSky::sunSolidAngle, T, T2, tanf, SunSky::theta, SunSky::toSun, turb(), SunSky::turbidity, SunSky::zenith_x, SunSky::zenith_y, and SunSky::zenith_Y.

Referenced by add_render_lamp().