#include "pbrt.h"
#include "geometry.h"
#include "rng.h"
Go to the source code of this file.
Classes | |
struct | Distribution1D |
struct | Distribution2D |
class | PermutedHalton |
Functions | |
void | RejectionSampleDisk (float u1, float u2, float *x, float *y) |
Vector | UniformSampleHemisphere (float u1, float u2) |
float | UniformHemispherePdf () |
Vector | UniformSampleSphere (float u1, float u2) |
float | UniformSpherePdf () |
Vector | UniformSampleCone (float u1, float u2, float thetamax) |
Vector | UniformSampleCone (float u1, float u2, float thetamax, const Vector &x, const Vector &y, const Vector &z) |
float | UniformConePdf (float thetamax) |
void | UniformSampleDisk (float u1, float u2, float *x, float *y) |
void | ConcentricSampleDisk (float u1, float u2, float *dx, float *dy) |
Vector | CosineSampleHemisphere (float u1, float u2) |
float | CosineHemispherePdf (float costheta, float phi) |
void | UniformSampleTriangle (float ud1, float ud2, float *u, float *v) |
void | StratifiedSample1D (float *samples, int nsamples, RNG &rng, bool jitter=true) |
void | StratifiedSample2D (float *samples, int nx, int ny, RNG &rng, bool jitter=true) |
template<typename T > | |
void | Shuffle (T *samp, uint32_t count, uint32_t dims, RNG &rng) |
void | LatinHypercube (float *samples, uint32_t nSamples, uint32_t nDim, RNG &rng) |
double | RadicalInverse (int n, int base) |
void | GeneratePermutation (uint32_t *buf, uint32_t b, RNG &rng) |
double | PermutedRadicalInverse (uint32_t n, uint32_t base, const uint32_t *p) |
float | VanDerCorput (uint32_t n, uint32_t scramble=0) |
float | Sobol2 (uint32_t n, uint32_t scramble=0) |
float | LarcherPillichshammer2 (uint32_t n, uint32_t scramble=0) |
void | Sample02 (uint32_t n, const uint32_t scramble[2], float sample[2]) |
int | LDPixelSampleFloatsNeeded (const Sample *sample, int nPixelSamples) |
void | LDPixelSample (int xPos, int yPos, float shutterOpen, float shutterClose, int nPixelSamples, Sample *samples, float *buf, RNG &rng) |
Vector | SampleHG (const Vector &w, float g, float u1, float u2) |
float | HGPdf (const Vector &w, const Vector &wp, float g) |
float | BalanceHeuristic (int nf, float fPdf, int ng, float gPdf) |
float | PowerHeuristic (int nf, float fPdf, int ng, float gPdf) |
void | LDShuffleScrambled1D (int nSamples, int nPixel, float *samples, RNG &rng) |
void | LDShuffleScrambled2D (int nSamples, int nPixel, float *samples, RNG &rng) |
Variables | |
static const float | OneMinusEpsilon = 0x1.fffffep-1 |
float BalanceHeuristic | ( | int | nf, | |
float | fPdf, | |||
int | ng, | |||
float | gPdf | |||
) | [inline] |
Definition at line 243 of file montecarlo.h.
void ConcentricSampleDisk | ( | float | u1, | |
float | u2, | |||
float * | dx, | |||
float * | dy | |||
) |
Definition at line 298 of file montecarlo.cpp.
References M_PI.
Referenced by CosineSampleHemisphere(), PerspectiveCamera::GenerateRay(), OrthoCamera::GenerateRay(), PerspectiveCamera::GenerateRayDifferential(), OrthoCamera::GenerateRayDifferential(), Disk::Sample(), InfiniteAreaLight::Sample_L(), and DistantLight::Sample_L().
float CosineHemispherePdf | ( | float | costheta, | |
float | phi | |||
) | [inline] |
Vector CosineSampleHemisphere | ( | float | u1, | |
float | u2 | |||
) | [inline] |
Definition at line 114 of file montecarlo.h.
References ConcentricSampleDisk(), Vector::x, Vector::y, and Vector::z.
Referenced by Gen_CosHemisphere(), IrradianceCacheIntegrator::indirectLo(), FresnelBlend::Sample_f(), and BxDF::Sample_f().
void GeneratePermutation | ( | uint32_t * | buf, | |
uint32_t | b, | |||
RNG & | rng | |||
) | [inline] |
Definition at line 185 of file montecarlo.h.
References Shuffle().
Referenced by PermutedHalton::PermutedHalton().
Definition at line 432 of file montecarlo.cpp.
References PhaseHG().
float LarcherPillichshammer2 | ( | uint32_t | n, | |
uint32_t | scramble = 0 | |||
) | [inline] |
Definition at line 283 of file montecarlo.h.
References OneMinusEpsilon.
void LatinHypercube | ( | float * | samples, | |
uint32_t | nSamples, | |||
uint32_t | nDim, | |||
RNG & | rng | |||
) |
Definition at line 163 of file montecarlo.cpp.
References OneMinusEpsilon, RNG::RandomFloat(), and RNG::RandomUInt().
Referenced by StratifiedSampler::GetMoreSamples(), and HaltonSampler::GetMoreSamples().
void LDPixelSample | ( | int | xPos, | |
int | yPos, | |||
float | shutterOpen, | |||
float | shutterClose, | |||
int | nPixelSamples, | |||
Sample * | samples, | |||
float * | buf, | |||
RNG & | rng | |||
) |
Definition at line 192 of file montecarlo.cpp.
References ALLOCA, CameraSample::imageX, CameraSample::imageY, LDShuffleScrambled1D(), LDShuffleScrambled2D(), CameraSample::lensU, CameraSample::lensV, Lerp(), Sample::n1D, Sample::n2D, and CameraSample::time.
Referenced by LDSampler::GetMoreSamples(), and AdaptiveSampler::GetMoreSamples().
int LDPixelSampleFloatsNeeded | ( | const Sample * | sample, | |
int | nPixelSamples | |||
) |
Definition at line 182 of file montecarlo.cpp.
References Sample::n1D, and Sample::n2D.
Referenced by LDSampler::GetMoreSamples(), and AdaptiveSampler::GetMoreSamples().
void LDShuffleScrambled1D | ( | int | nSamples, | |
int | nPixel, | |||
float * | samples, | |||
RNG & | rng | |||
) | [inline] |
Definition at line 290 of file montecarlo.h.
References RNG::RandomUInt(), Shuffle(), and VanDerCorput().
Referenced by BestCandidateSampler::GetMoreSamples(), LDPixelSample(), SingleScatteringIntegrator::Li(), and IGIIntegrator::Preprocess().
void LDShuffleScrambled2D | ( | int | nSamples, | |
int | nPixel, | |||
float * | samples, | |||
RNG & | rng | |||
) | [inline] |
Definition at line 301 of file montecarlo.h.
References RNG::RandomUInt(), Sample02(), and Shuffle().
Referenced by BestCandidateSampler::GetMoreSamples(), LDPixelSample(), SingleScatteringIntegrator::Li(), and IGIIntegrator::Preprocess().
double PermutedRadicalInverse | ( | uint32_t | n, | |
uint32_t | base, | |||
const uint32_t * | p | |||
) | [inline] |
Definition at line 192 of file montecarlo.h.
Referenced by PermutedHalton::Sample().
float PowerHeuristic | ( | int | nf, | |
float | fPdf, | |||
int | ng, | |||
float | gPdf | |||
) | [inline] |
Definition at line 248 of file montecarlo.h.
Referenced by EstimateDirect(), and PhotonIntegrator::Li().
double RadicalInverse | ( | int | n, | |
int | base | |||
) | [inline] |
Definition at line 171 of file montecarlo.h.
Referenced by HaltonSampler::GetMoreSamples(), and CreateRadProbeTask::Run().
void RejectionSampleDisk | ( | float | u1, | |
float | u2, | |||
float * | x, | |||
float * | y | |||
) |
void Sample02 | ( | uint32_t | n, | |
const uint32_t | scramble[2], | |||
float | sample[2] | |||
) | [inline] |
Definition at line 256 of file montecarlo.h.
References Sobol2(), and VanDerCorput().
Referenced by IrradianceCacheIntegrator::indirectLo(), LDShuffleScrambled2D(), AmbientOcclusionIntegrator::Li(), DipoleSubsurfaceIntegrator::Preprocess(), MetropolisRenderer::Render(), SHComputeBSDFMatrix(), SHComputeDiffuseTransfer(), SHComputeTransferMatrix(), Light::SHProject(), and SHProjectIncidentIndirectRadiance().
Definition at line 415 of file montecarlo.cpp.
References CoordinateSystem(), M_PI, and SphericalDirection().
void Shuffle | ( | T * | samp, | |
uint32_t | count, | |||
uint32_t | dims, | |||
RNG & | rng | |||
) | [inline] |
Definition at line 161 of file montecarlo.h.
References RNG::RandomUInt().
Referenced by GeneratePermutation(), StratifiedSampler::GetMoreSamples(), LDShuffleScrambled1D(), LDShuffleScrambled2D(), and MLTTask::Run().
float Sobol2 | ( | uint32_t | n, | |
uint32_t | scramble = 0 | |||
) | [inline] |
void StratifiedSample1D | ( | float * | samples, | |
int | nsamples, | |||
RNG & | rng, | |||
bool | jitter = true | |||
) |
Definition at line 140 of file montecarlo.cpp.
References OneMinusEpsilon, and RNG::RandomFloat().
Referenced by StratifiedSampler::GetMoreSamples().
void StratifiedSample2D | ( | float * | samples, | |
int | nx, | |||
int | ny, | |||
RNG & | rng, | |||
bool | jitter = true | |||
) |
Definition at line 150 of file montecarlo.cpp.
References OneMinusEpsilon, and RNG::RandomFloat().
Referenced by StratifiedSampler::GetMoreSamples(), and BSDF::rho().
float UniformConePdf | ( | float | thetamax | ) |
Definition at line 392 of file montecarlo.cpp.
References M_PI.
Referenced by PhotonIntegrator::Li(), Sphere::Pdf(), SpotLight::Sample_L(), and ProjectionLight::Sample_L().
float UniformHemispherePdf | ( | ) |
Definition at line 270 of file montecarlo.cpp.
References INV_TWOPI.
Referenced by Gen_UniformHemisphere().
Vector UniformSampleCone | ( | float | u1, | |
float | u2, | |||
float | thetamax, | |||
const Vector & | x, | |||
const Vector & | y, | |||
const Vector & | z | |||
) |
Definition at line 405 of file montecarlo.cpp.
Vector UniformSampleCone | ( | float | u1, | |
float | u2, | |||
float | thetamax | |||
) |
Definition at line 397 of file montecarlo.cpp.
References M_PI.
Referenced by PhotonIntegrator::Li(), Sphere::Sample(), SpotLight::Sample_L(), and ProjectionLight::Sample_L().
void UniformSampleDisk | ( | float | u1, | |
float | u2, | |||
float * | x, | |||
float * | y | |||
) |
Definition at line 290 of file montecarlo.cpp.
References M_PI.
Vector UniformSampleHemisphere | ( | float | u1, | |
float | u2 | |||
) |
Definition at line 260 of file montecarlo.cpp.
References M_PI.
Referenced by Gen_UniformHemisphere(), and BxDF::rho().
Vector UniformSampleSphere | ( | float | u1, | |
float | u2 | |||
) |
Definition at line 275 of file montecarlo.cpp.
References M_PI.
Referenced by AmbientOcclusionIntegrator::Li(), CreateRadianceProbes::Render(), AggregateTest::Render(), SurfacePointTask::Run(), Sphere::Sample(), PointLight::Sample_L(), GonioPhotometricLight::Sample_L(), DiffuseAreaLight::Sample_L(), SHComputeBSDFMatrix(), SHComputeDiffuseTransfer(), SHComputeTransferMatrix(), and SHProjectIncidentIndirectRadiance().
void UniformSampleTriangle | ( | float | ud1, | |
float | ud2, | |||
float * | u, | |||
float * | v | |||
) |
Definition at line 343 of file montecarlo.cpp.
Referenced by Triangle::Sample().
float UniformSpherePdf | ( | ) |
Definition at line 285 of file montecarlo.cpp.
References M_PI.
Referenced by PointLight::Sample_L(), GonioPhotometricLight::Sample_L(), SHComputeBSDFMatrix(), SHComputeDiffuseTransfer(), SHComputeTransferMatrix(), and SHProjectIncidentIndirectRadiance().
float VanDerCorput | ( | uint32_t | n, | |
uint32_t | scramble = 0 | |||
) | [inline] |
Definition at line 263 of file montecarlo.h.
References OneMinusEpsilon.
Referenced by LDShuffleScrambled1D(), DipoleSubsurfaceIntegrator::Preprocess(), Sample02(), and Light::SHProject().
const float OneMinusEpsilon = 0x1.fffffep-1 [static] |
Definition at line 42 of file montecarlo.h.
Referenced by LarcherPillichshammer2(), LatinHypercube(), PermutedHalton::Sample(), Sobol2(), StratifiedSample1D(), StratifiedSample2D(), and VanDerCorput().