#include <sky.h>
Public Member Functions | |
SkyLight (const Transform &light2world, const float skyscale, int ns, Vector sd, float turb, float aconst, float bconst, float cconst, float dconst, float econst) | |
virtual | ~SkyLight () |
virtual SWCSpectrum | Power (const TsPack *tspack, const Scene *scene) const |
virtual bool | IsDeltaLight () const |
virtual bool | IsEnvironmental () const |
virtual SWCSpectrum | Le (const TsPack *tspack, const RayDifferential &r) const |
virtual SWCSpectrum | Le (const TsPack *tspack, const Scene *scene, const Ray &r, const Normal &n, BSDF **bsdf, float *pdf, float *pdfDirect) const |
virtual SWCSpectrum | Sample_L (const TsPack *tspack, const Point &p, const Normal &n, float u1, float u2, float u3, Vector *wi, float *pdf, VisibilityTester *visibility) const |
virtual SWCSpectrum | Sample_L (const TsPack *tspack, const Point &p, float u1, float u2, float u3, Vector *wi, float *pdf, VisibilityTester *visibility) const |
virtual SWCSpectrum | Sample_L (const TsPack *tspack, const Scene *scene, float u1, float u2, float u3, float u4, Ray *ray, float *pdf) const |
virtual float | Pdf (const Point &, const Normal &, const Vector &) const |
virtual float | Pdf (const Point &, const Vector &) const |
virtual float | Pdf (const Point &p, const Normal &n, const Point &po, const Normal &ns) const |
virtual bool | Sample_L (const TsPack *tspack, const Scene *scene, float u1, float u2, float u3, BSDF **bsdf, float *pdf, SWCSpectrum *Le) const |
virtual bool | Sample_L (const TsPack *tspack, const Scene *scene, const Point &p, const Normal &n, float u1, float u2, float u3, BSDF **bsdf, float *pdf, float *pdfDirect, VisibilityTester *visibility, SWCSpectrum *Le) const |
void | GetSkySpectralRadiance (const TsPack *tspack, const float theta, const float phi, SWCSpectrum *const dst_spect) const |
Static Public Member Functions | |
static Light * | CreateLight (const Transform &light2world, const ParamSet ¶mSet, const TextureParams &tp) |
Private Member Functions | |
Vector | GetSunPosition () const |
void | SunThetaPhi (float &theta, float &phi) const |
RGBColor | GetSunSpectralRadiance () const |
float | GetSunSolidAngle () const |
void | GetAtmosphericEffects (const Vector &viewer, const Vector &source, RGBColor &atmAttenuation, RGBColor &atmInscatter) const |
void | InitSunThetaPhi () |
void | ChromaticityToSpectrum (const TsPack *tspack, const float x, const float y, SWCSpectrum *const dst_spect) const |
Private Attributes | |
float | skyScale |
Vector | sundir |
float | turbidity |
float | thetaS |
float | phiS |
float | zenith_Y |
float | zenith_x |
float | zenith_y |
float | perez_Y [6] |
float | perez_x [6] |
float | perez_y [6] |
Definition at line 35 of file sky.h.
SkyLight::SkyLight | ( | const Transform & | light2world, | |
const float | skyscale, | |||
int | ns, | |||
Vector | sd, | |||
float | turb, | |||
float | aconst, | |||
float | bconst, | |||
float | cconst, | |||
float | dconst, | |||
float | econst | |||
) |
Definition at line 142 of file sky.cpp.
References InitSunThetaPhi(), M_PI, perez_x, perez_y, perez_Y, PerezBase(), skyScale, sundir, cimg_library::tan(), thetaS, turbidity, zenith_x, zenith_y, and zenith_Y.
Referenced by CreateLight().
void SkyLight::ChromaticityToSpectrum | ( | const TsPack * | tspack, | |
const float | x, | |||
const float | y, | |||
SWCSpectrum *const | dst_spect | |||
) | const [private] |
Definition at line 619 of file sky.cpp.
References lux::SWCSpectrum::c, S0(), S0Y, S1(), S2(), lux::SPD::sample(), lux::TsPack::swl, lux::SpectrumWavelengths::w, and WAVELENGTH_SAMPLES.
Referenced by GetSkySpectralRadiance().
Light * SkyLight::CreateLight | ( | const Transform & | light2world, | |
const ParamSet & | paramSet, | |||
const TextureParams & | tp | |||
) | [static] |
Definition at line 557 of file sky.cpp.
References lux::ParamSet::FindOneFloat(), lux::ParamSet::FindOneInt(), lux::ParamSet::FindOneVector(), lux::Normalize(), lux::Light::nSamples, SkyLight(), and sundir.
void lux::SkyLight::GetAtmosphericEffects | ( | const Vector & | viewer, | |
const Vector & | source, | |||
RGBColor & | atmAttenuation, | |||
RGBColor & | atmInscatter | |||
) | const [private] |
void SkyLight::GetSkySpectralRadiance | ( | const TsPack * | tspack, | |
const float | theta, | |||
const float | phi, | |||
SWCSpectrum *const | dst_spect | |||
) | const |
Definition at line 603 of file sky.cpp.
References ChromaticityToSpectrum(), M_PI, cimg_library::cimg::min(), perez_x, perez_Y, perez_y, PerezBase(), phiS, RiAngleBetween(), thetaS, zenith_x, zenith_Y, and zenith_y.
Referenced by SkyPortalBxDF::f(), SkyBxDF::f(), Le(), Power(), and SkyPortalBxDF::Sample_f().
Vector lux::SkyLight::GetSunPosition | ( | ) | const [private] |
float lux::SkyLight::GetSunSolidAngle | ( | ) | const [private] |
RGBColor lux::SkyLight::GetSunSpectralRadiance | ( | ) | const [private] |
void SkyLight::InitSunThetaPhi | ( | ) | [private] |
Definition at line 589 of file sky.cpp.
References lux::Normalize(), phiS, lux::SphericalPhi(), lux::SphericalTheta(), sundir, and thetaS.
Referenced by SkyLight().
virtual bool lux::SkyLight::IsDeltaLight | ( | ) | const [inline, virtual] |
Implements lux::Light.
virtual bool lux::SkyLight::IsEnvironmental | ( | ) | const [inline, virtual] |
Implements lux::Light.
SWCSpectrum SkyLight::Le | ( | const TsPack * | tspack, | |
const Scene * | scene, | |||
const Ray & | r, | |||
const Normal & | n, | |||
BSDF ** | bsdf, | |||
float * | pdf, | |||
float * | pdfDirect | |||
) | const [virtual] |
Reimplemented from lux::Light.
Definition at line 208 of file sky.cpp.
References lux::AbsDot(), lux::BBox::BoundingSphere(), BSDF_ALLOC, lux::CoordinateSystem(), lux::Ray::d, lux::Intersection::dg, lux::DistanceSquared(), lux::Dot(), GetSkySpectralRadiance(), lux::Light::havePortalShape, INV_TWOPI, lux::Vector::LengthSquared(), M_PI, lux::Ray::mint, lux::DifferentialGeometry::nn, lux::Normalize(), lux::Light::nrPortalShapes, lux::Ray::o, lux::DifferentialGeometry::p, lux::Light::PortalShapes, skyScale, lux::SphericalPhi(), lux::SphericalTheta(), lux::TsPack::time, lux::DifferentialGeometry::time, lux::Scene::WorldBound(), and lux::Light::WorldToLight.
SWCSpectrum SkyLight::Le | ( | const TsPack * | tspack, | |
const RayDifferential & | r | |||
) | const [virtual] |
Reimplemented from lux::Light.
Definition at line 194 of file sky.cpp.
References lux::Ray::d, GetSkySpectralRadiance(), lux::Normalize(), skyScale, lux::SphericalPhi(), lux::SphericalTheta(), and lux::Light::WorldToLight.
Referenced by Sample_L().
float SkyLight::Pdf | ( | const Point & | p, | |
const Normal & | n, | |||
const Point & | po, | |||
const Normal & | ns | |||
) | const [virtual] |
Implements lux::Light.
Definition at line 318 of file sky.cpp.
References lux::AbsDot(), lux::Intersection::dg, lux::DistanceSquared(), lux::Dot(), lux::Light::havePortalShape, INV_TWOPI, lux::Vector::LengthSquared(), lux::Ray::mint, lux::DifferentialGeometry::nn, lux::Light::nrPortalShapes, lux::DifferentialGeometry::p, and lux::Light::PortalShapes.
Reimplemented from lux::Light.
Definition at line 302 of file sky.cpp.
References lux::AbsDot(), lux::Intersection::dg, lux::Dot(), lux::Light::havePortalShape, INV_TWOPI, lux::DifferentialGeometry::nn, lux::Light::nrPortalShapes, and lux::Light::PortalShapes.
virtual SWCSpectrum lux::SkyLight::Power | ( | const TsPack * | tspack, | |
const Scene * | scene | |||
) | const [inline, virtual] |
Implements lux::Light.
Definition at line 40 of file sky.h.
References lux::BBox::BoundingSphere(), GetSkySpectralRadiance(), lux::Light::havePortalShape, M_PI, lux::Light::PortalArea, and lux::Scene::WorldBound().
bool SkyLight::Sample_L | ( | const TsPack * | tspack, | |
const Scene * | scene, | |||
const Point & | p, | |||
const Normal & | n, | |||
float | u1, | |||
float | u2, | |||
float | u3, | |||
BSDF ** | bsdf, | |||
float * | pdf, | |||
float * | pdfDirect, | |||
VisibilityTester * | visibility, | |||
SWCSpectrum * | Le | |||
) | const [virtual] |
Reimplemented from lux::Light.
Definition at line 466 of file sky.cpp.
References lux::AbsDot(), lux::BBox::BoundingSphere(), BSDF_ALLOC, lux::ConcentricSampleDisk(), lux::CoordinateSystem(), lux::Intersection::dg, lux::DistanceSquared(), lux::Dot(), Floor2Int(), lux::Light::havePortalShape, INV_TWOPI, lux::Vector::LengthSquared(), M_PI, cimg_library::cimg::max(), cimg_library::cimg::min(), lux::Ray::mint, lux::DifferentialGeometry::nn, lux::Normalize(), lux::Light::nrPortalShapes, lux::DifferentialGeometry::p, lux::Light::PortalShapes, lux::VisibilityTester::SetSegment(), skyScale, lux::TsPack::time, lux::DifferentialGeometry::time, lux::Scene::WorldBound(), lux::Light::WorldToLight, lux::Vector::x, lux::Vector::y, and lux::Vector::z.
bool SkyLight::Sample_L | ( | const TsPack * | tspack, | |
const Scene * | scene, | |||
float | u1, | |||
float | u2, | |||
float | u3, | |||
BSDF ** | bsdf, | |||
float * | pdf, | |||
SWCSpectrum * | Le | |||
) | const [virtual] |
Reimplemented from lux::Light.
Definition at line 412 of file sky.cpp.
References lux::AbsDot(), lux::BBox::BoundingSphere(), BSDF_ALLOC, lux::CoordinateSystem(), lux::Dot(), lux::DifferentialGeometry::dpdu, lux::DifferentialGeometry::dpdv, Floor2Int(), lux::Light::havePortalShape, INV_TWOPI, M_PI, cimg_library::cimg::min(), lux::DifferentialGeometry::nn, lux::Normalize(), lux::Light::nrPortalShapes, lux::DifferentialGeometry::p, lux::Light::PortalShapes, skyScale, lux::TsPack::time, lux::DifferentialGeometry::time, lux::UniformSampleHemisphere(), lux::UniformSampleSphere(), lux::Scene::WorldBound(), lux::Light::WorldToLight, lux::Vector::x, lux::Vector::y, and lux::Vector::z.
SWCSpectrum SkyLight::Sample_L | ( | const TsPack * | tspack, | |
const Scene * | scene, | |||
float | u1, | |||
float | u2, | |||
float | u3, | |||
float | u4, | |||
Ray * | ray, | |||
float * | ||||
) | const [virtual] |
Implements lux::Light.
Definition at line 372 of file sky.cpp.
References lux::AbsDot(), lux::BBox::BoundingSphere(), lux::Ray::d, lux::Dot(), lux::RandomGenerator::floatValue(), Floor2Int(), lux::Light::havePortalShape, INV_TWOPI, Le(), M_PI, cimg_library::cimg::min(), lux::DifferentialGeometry::nn, lux::Normalize(), lux::Light::nrPortalShapes, lux::Ray::o, lux::DifferentialGeometry::p, lux::Light::PortalShapes, lux::TsPack::rng, lux::TsPack::time, lux::DifferentialGeometry::time, lux::UniformSampleSphere(), and lux::Scene::WorldBound().
SWCSpectrum SkyLight::Sample_L | ( | const TsPack * | tspack, | |
const Point & | p, | |||
float | u1, | |||
float | u2, | |||
float | u3, | |||
Vector * | wi, | |||
float * | pdf, | |||
VisibilityTester * | visibility | |||
) | const [virtual] |
Implements lux::Light.
Definition at line 339 of file sky.cpp.
References lux::Dot(), Floor2Int(), lux::Light::havePortalShape, Le(), cimg_library::cimg::min(), lux::DifferentialGeometry::nn, lux::Normalize(), lux::Light::nrPortalShapes, lux::DifferentialGeometry::p, lux::Light::PortalShapes, lux::VisibilityTester::SetRay(), lux::TsPack::time, lux::DifferentialGeometry::time, lux::UniformSampleSphere(), and lux::UniformSpherePdf().
SWCSpectrum SkyLight::Sample_L | ( | const TsPack * | tspack, | |
const Point & | p, | |||
const Normal & | n, | |||
float | u1, | |||
float | u2, | |||
float | u3, | |||
Vector * | wi, | |||
float * | pdf, | |||
VisibilityTester * | visibility | |||
) | const [virtual] |
Reimplemented from lux::Light.
Definition at line 259 of file sky.cpp.
References lux::ConcentricSampleDisk(), lux::CoordinateSystem(), lux::Dot(), Floor2Int(), lux::Light::havePortalShape, INV_TWOPI, Le(), cimg_library::cimg::max(), cimg_library::cimg::min(), lux::DifferentialGeometry::nn, lux::Normalize(), lux::Light::nrPortalShapes, lux::DifferentialGeometry::p, lux::Light::PortalShapes, lux::VisibilityTester::SetRay(), lux::TsPack::time, lux::DifferentialGeometry::time, lux::Normal::x, lux::Vector::x, lux::Normal::y, lux::Vector::y, lux::Normal::z, and lux::Vector::z.
void lux::SkyLight::SunThetaPhi | ( | float & | theta, | |
float & | phi | |||
) | const [private] |
float lux::SkyLight::perez_x[6] [private] |
Definition at line 91 of file sky.h.
Referenced by GetSkySpectralRadiance(), and SkyLight().
float lux::SkyLight::perez_y[6] [private] |
Definition at line 91 of file sky.h.
Referenced by GetSkySpectralRadiance(), and SkyLight().
float lux::SkyLight::perez_Y[6] [private] |
Definition at line 91 of file sky.h.
Referenced by GetSkySpectralRadiance(), and SkyLight().
float lux::SkyLight::phiS [private] |
Definition at line 89 of file sky.h.
Referenced by GetSkySpectralRadiance(), and InitSunThetaPhi().
float lux::SkyLight::skyScale [private] |
Definition at line 86 of file sky.h.
Referenced by Le(), Sample_L(), and SkyLight().
Vector lux::SkyLight::sundir [private] |
Definition at line 87 of file sky.h.
Referenced by CreateLight(), InitSunThetaPhi(), and SkyLight().
float lux::SkyLight::thetaS [private] |
Definition at line 89 of file sky.h.
Referenced by GetSkySpectralRadiance(), InitSunThetaPhi(), and SkyLight().
float lux::SkyLight::turbidity [private] |
Definition at line 88 of file sky.h.
Referenced by SkyLight().
float lux::SkyLight::zenith_x [private] |
Definition at line 90 of file sky.h.
Referenced by GetSkySpectralRadiance(), and SkyLight().
float lux::SkyLight::zenith_y [private] |
Definition at line 90 of file sky.h.
Referenced by GetSkySpectralRadiance(), and SkyLight().
float lux::SkyLight::zenith_Y [private] |
Definition at line 90 of file sky.h.
Referenced by GetSkySpectralRadiance(), and SkyLight().