#include "stdafx.h"
#include "sh.h"
#include "scene.h"
#include "integrator.h"
#include "intersection.h"
#include "montecarlo.h"
#include "imageio.h"
#include <float.h>
Go to the source code of this file.
Defines | |
#define | P(l, m) out[SHIndex(l,m)] |
#define | M(a, b) (m.m[a][b]) |
Functions | |
static void | legendrep (float x, int lmax, float *out) |
static float | fact (float v) |
static float | divfact (int a, int b) |
static float | K (int l, int m) |
static float | dfact (float v) |
static void | sinCosIndexed (float s, float c, int n, float *sout, float *cout) |
static void | toZYZ (const Matrix4x4 &m, float *alpha, float *beta, float *gamma) |
static float | lambda (float l) |
void | SHEvaluate (const Vector &w, int lmax, float *out) |
void | SHWriteImage (const char *filename, const Spectrum *c, int lmax, int yres) |
void | SHProjectIncidentDirectRadiance (const Point &p, float pEpsilon, float time, MemoryArena &arena, const Scene *scene, bool computeLightVis, int lmax, RNG &rng, Spectrum *c_d) |
void | SHProjectIncidentIndirectRadiance (const Point &p, float pEpsilon, float time, const Renderer *renderer, Sample *origSample, const Scene *scene, int lmax, RNG &rng, int ns, Spectrum *c_i) |
void | SHReduceRinging (Spectrum *c, int lmax, float lambda) |
void | SHRotate (const Spectrum *c_in, Spectrum *c_out, const Matrix4x4 &m, int lmax, MemoryArena &arena) |
void | SHRotateZ (const Spectrum *c_in, Spectrum *c_out, float alpha, int lmax) |
void | SHConvolveCosTheta (int lmax, const Spectrum *c_in, Spectrum *c_out) |
void | SHConvolvePhong (int lmax, float n, const Spectrum *c_in, Spectrum *c_out) |
void | SHComputeDiffuseTransfer (const Point &p, const Normal &n, float rayEpsilon, const Scene *scene, RNG &rng, int nSamples, int lmax, Spectrum *c_transfer) |
void | SHComputeTransferMatrix (const Point &p, float rayEpsilon, const Scene *scene, RNG &rng, int nSamples, int lmax, Spectrum *T) |
void | SHComputeBSDFMatrix (const Spectrum &Kd, const Spectrum &Ks, float roughness, RNG &rng, int nSamples, int lmax, Spectrum *B) |
void | SHMatrixVectorMultiply (const Spectrum *M, const Spectrum *v, Spectrum *vout, int lmax) |
#define M | ( | a, | |||
b | ) | (m.m[a][b]) |
#define P | ( | l, | |||
m | ) | out[SHIndex(l,m)] |
Referenced by CreateLoopSubdivShape(), CreateNURBSShape(), CreatePointLight(), CreateTriangleMeshShape(), WrinkledTexture< T >::Evaluate(), WindyTexture< T >::Evaluate(), MarbleTexture::Evaluate(), FBmTexture< T >::Evaluate(), legendrep(), NURBSEvaluateSurface(), LoopSubdiv::ObjectBound(), LoopSubdiv::Refine(), Heightfield::Refine(), LoopSubdiv::weightBoundary(), and LoopSubdiv::weightOneRing().
static float dfact | ( | float | v | ) | [static] |
Definition at line 115 of file sh.cpp.
Referenced by legendrep().
static float divfact | ( | int | a, | |
int | b | |||
) | [inline, static] |
static float fact | ( | float | v | ) | [inline, static] |
Definition at line 121 of file sh.cpp.
Referenced by legendrep().
static float K | ( | int | l, | |
int | m | |||
) | [inline, static] |
Definition at line 99 of file sh.cpp.
References divfact(), and INV_FOURPI.
Referenced by SHEvaluate().
static float lambda | ( | float | l | ) | [inline, static] |
Definition at line 158 of file sh.cpp.
References M_PI.
Referenced by FBm(), SHConvolveCosTheta(), SHConvolvePhong(), and Turbulence().
static void legendrep | ( | float | x, | |
int | lmax, | |||
float * | out | |||
) | [static] |
void SHComputeBSDFMatrix | ( | const Spectrum & | Kd, | |
const Spectrum & | Ks, | |||
float | roughness, | |||
RNG & | rng, | |||
int | nSamples, | |||
int | lmax, | |||
Spectrum * | B | |||
) |
Definition at line 437 of file sh.cpp.
References BSDF::Add(), arena, BSDF_ALLOC, CosTheta(), BSDF::f(), CoefficientSpectrum< nSamples >::IsBlack(), RNG::RandomUInt(), Sample02(), SHEvaluate(), SHTerms(), UniformSampleSphere(), and UniformSpherePdf().
Referenced by GlossyPRTIntegrator::Preprocess().
void SHComputeDiffuseTransfer | ( | const Point & | p, | |
const Normal & | n, | |||
float | rayEpsilon, | |||
const Scene * | scene, | |||
RNG & | rng, | |||
int | nSamples, | |||
int | lmax, | |||
Spectrum * | c_transfer | |||
) |
Definition at line 390 of file sh.cpp.
References AbsDot(), ALLOCA, Dot(), Scene::IntersectP(), RNG::RandomUInt(), Sample02(), SHEvaluate(), SHTerms(), UniformSampleSphere(), and UniformSpherePdf().
Referenced by DiffusePRTIntegrator::Li().
void SHComputeTransferMatrix | ( | const Point & | p, | |
float | rayEpsilon, | |||
const Scene * | scene, | |||
RNG & | rng, | |||
int | nSamples, | |||
int | lmax, | |||
Spectrum * | T | |||
) |
Definition at line 413 of file sh.cpp.
References ALLOCA, Scene::IntersectP(), RNG::RandomUInt(), Sample02(), SHEvaluate(), SHTerms(), UniformSampleSphere(), and UniformSpherePdf().
Referenced by GlossyPRTIntegrator::Li().
Definition at line 362 of file sh.cpp.
References lambda(), and SHIndex().
Referenced by UseRadianceProbes::Li().
void SHEvaluate | ( | const Vector & | w, | |
int | lmax, | |||
float * | out | |||
) |
Definition at line 165 of file sh.cpp.
References ALLOCA, Assert, K(), legendrep(), Vector::Length(), Severe(), SHIndex(), SHTerms(), sinCosIndexed(), Vector::x, Vector::y, and Vector::z.
Referenced by UseRadianceProbes::Li(), GlossyPRTIntegrator::Li(), SHComputeBSDFMatrix(), SHComputeDiffuseTransfer(), SHComputeTransferMatrix(), PointLight::SHProject(), Light::SHProject(), InfiniteAreaLight::SHProject(), SHProjectCube(), SHProjectIncidentIndirectRadiance(), and SHWriteImage().
Definition at line 486 of file sh.cpp.
References SHTerms().
Referenced by GlossyPRTIntegrator::Li().
void SHProjectIncidentDirectRadiance | ( | const Point & | p, | |
float | pEpsilon, | |||
float | time, | |||
MemoryArena & | arena, | |||
const Scene * | scene, | |||
bool | computeLightVis, | |||
int | lmax, | |||
RNG & | rng, | |||
Spectrum * | c_d | |||
) |
Definition at line 261 of file sh.cpp.
References MemoryArena::Alloc(), Scene::lights, Light::SHProject(), SHReduceRinging(), and SHTerms().
Referenced by GlossyPRTIntegrator::Preprocess(), DiffusePRTIntegrator::Preprocess(), and CreateRadProbeTask::Run().
void SHProjectIncidentIndirectRadiance | ( | const Point & | p, | |
float | pEpsilon, | |||
float | time, | |||
const Renderer * | renderer, | |||
Sample * | origSample, | |||
const Scene * | scene, | |||
int | lmax, | |||
RNG & | rng, | |||
int | ns, | |||
Spectrum * | c_i | |||
) |
Definition at line 277 of file sh.cpp.
References ALLOCA, arena, Sample::Duplicate(), MemoryArena::FreeAll(), INFINITY, Renderer::Li(), Sample::n1D, Sample::n2D, Sample::oneD, RNG::RandomFloat(), RNG::RandomUInt(), RoundUpPow2(), Sample02(), SHEvaluate(), SHTerms(), CameraSample::time, Sample::twoD, UniformSampleSphere(), and UniformSpherePdf().
Referenced by CreateRadProbeTask::Run().
void SHReduceRinging | ( | Spectrum * | c, | |
int | lmax, | |||
float | lambda | |||
) |
Definition at line 316 of file sh.cpp.
References SHIndex().
Referenced by SHProjectIncidentDirectRadiance().
void SHRotate | ( | const Spectrum * | c_in, | |
Spectrum * | c_out, | |||
const Matrix4x4 & | m, | |||
int | lmax, | |||
MemoryArena & | arena | |||
) |
Definition at line 325 of file sh.cpp.
References MemoryArena::Alloc(), SHRotateXMinus(), SHRotateXPlus(), SHRotateZ(), SHTerms(), and toZYZ().
Referenced by GlossyPRTIntegrator::Li().
Definition at line 338 of file sh.cpp.
References ALLOCA, Assert, SHIndex(), and sinCosIndexed().
Referenced by SHRotate().
void SHWriteImage | ( | const char * | filename, | |
const Spectrum * | c, | |||
int | lmax, | |||
int | yres | |||
) |
Definition at line 237 of file sh.cpp.
References ALLOCA, M_PI, SHEvaluate(), SHTerms(), SphericalDirection(), RGBSpectrum::ToRGB(), and WriteImage().
static void sinCosIndexed | ( | float | s, | |
float | c, | |||
int | n, | |||
float * | sout, | |||
float * | cout | |||
) | [static] |
Definition at line 127 of file sh.cpp.
Referenced by SHEvaluate(), and SHRotateZ().
static void toZYZ | ( | const Matrix4x4 & | m, | |
float * | alpha, | |||
float * | beta, | |||
float * | gamma | |||
) | [static] |