Blender V2.61 - r43446
|
#include "sunsky.h"
#include "math.h"
#include "BLI_math.h"
#include "BKE_global.h"
Go to the source code of this file.
Defines | |
#define | vec3opv(v1, v2, op, v3) |
#define | vec3opf(v1, v2, op, f1) |
#define | fopvec3(v1, f1, op, v2) |
Functions | |
void | ClipColor (float c[3]) |
static float | AngleBetween (float thetav, float phiv, float theta, float phi) |
static void | DirectionToThetaPhi (float *toSun, float *theta, float *phi) |
static float | PerezFunction (struct SunSky *sunsky, const float *lam, float theta, float gamma, float lvz) |
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]) |
static void | ComputeAttenuatedSunlight (float theta, int turbidity, float fTau[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]) |
Definition in file sunsky.c.
#define fopvec3 | ( | v1, | |
f1, | |||
op, | |||
v2 | |||
) |
v1[0] = ((f1) op v2[0]);\ v1[1] = ((f1) op v2[1]);\ v1[2] = ((f1) op v2[2]);
compute v1 = f1 op v2 v1, v2 are vectors contains 3 float and f1 is a float
Definition at line 60 of file sunsky.c.
Referenced by AtmospherePixleShader().
#define vec3opf | ( | v1, | |
v2, | |||
op, | |||
f1 | |||
) |
v1[0] = (v2[0] op (f1));\ v1[1] = (v2[1] op (f1));\ v1[2] = (v2[2] op (f1));
compute v1 = v2 op f1 v1, v2 are vectors contains 3 float and f1 is a float
Definition at line 50 of file sunsky.c.
Referenced by AtmospherePixleShader(), and InitAtmosphere().
#define vec3opv | ( | v1, | |
v2, | |||
op, | |||
v3 | |||
) |
v1[0] = (v2[0] op v3[0]); \ v1[1] = (v2[1] op v3[1]);\ v1[2] = (v2[2] op v3[2]);
These macros are defined for vector operations compute v1 = v2 op v3 v1, v2 and v3 are vectors contains 3 float
Definition at line 40 of file sunsky.c.
Referenced by AtmospherePixleShader(), and InitAtmosphere().
static float AngleBetween | ( | float | thetav, |
float | phiv, | ||
float | theta, | ||
float | phi | ||
) | [static] |
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] | ) |
static void ComputeAttenuatedSunlight | ( | float | theta, |
int | turbidity, | ||
float | fTau[3] | ||
) | [static] |
ComputeAttenuatedSunlight: this function compute attenuated sun light based on sun's theta and atmosphere turbidity parameters: theta, is sun's theta turbidity: is atmosphere turbidity fTau: contains computed attenuated sun light
Definition at line 316 of file sunsky.c.
References cosf, KDL::exp(), expf, i, M_PI, and powf.
Referenced by AtmospherePixleShader().
static void DirectionToThetaPhi | ( | float * | toSun, |
float * | theta, | ||
float * | phi | ||
) | [static] |
DirectionToThetaPhi: this function convert a direction to it's theta and phi value parameters: toSun: contains direction information theta, phi, are return values from this conversion
Definition at line 103 of file sunsky.c.
References acos(), KDL::atan2(), credits_svn_gen::e, and fabs().
Referenced by GetSkyXYZRadiancef(), and InitSunSky().
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().
static float PerezFunction | ( | struct SunSky * | sunsky, |
const float * | lam, | ||
float | theta, | ||
float | gamma, | ||
float | lvz | ||
) | [static] |
PerezFunction: compute perez function value based on input paramters
Definition at line 116 of file sunsky.c.
References cosf, expf, and SunSky::theta.
Referenced by GetSkyXYZRadiance().