19 #include <nori/warp.h>
20 #include <nori/vector.h>
21 #include <nori/frame.h>
29 v.x() = 1.f - 2.f * sampler->
next1D();
30 v.y() = 1.f - 2.f * sampler->
next1D();
31 v.z() = 1.f - 2.f * sampler->
next1D();
32 }
while (v.squaredNorm() > 1.f);
34 if (v.dot(pole) < 0.f)
46 return ((sample.array() >= 0).all() && (sample.array() <= 1).all()) ? 1.0f : 0.0f;
50 throw NoriException(
"Warp::squareToUniformDisk() is not yet implemented!");
54 throw NoriException(
"Warp::squareToUniformDiskPdf() is not yet implemented!");
58 throw NoriException(
"Warp::squareToUniformSphereCap() is not yet implemented!");
62 throw NoriException(
"Warp::squareToUniformSphereCapPdf() is not yet implemented!");
66 throw NoriException(
"Warp::squareToUniformSphere() is not yet implemented!");
70 throw NoriException(
"Warp::squareToUniformSpherePdf() is not yet implemented!");
74 throw NoriException(
"Warp::squareToUniformHemisphere() is not yet implemented!");
78 throw NoriException(
"Warp::squareToUniformHemispherePdf() is not yet implemented!");
82 throw NoriException(
"Warp::squareToCosineHemisphere() is not yet implemented!");
86 throw NoriException(
"Warp::squareToCosineHemispherePdf() is not yet implemented!");
90 throw NoriException(
"Warp::squareToBeckmann() is not yet implemented!");
94 throw NoriException(
"Warp::squareToBeckmannPdf() is not yet implemented!");
98 float su1 = sqrtf(sample.x());
99 float u = 1.f - su1, v = sample.y() * su1;
Simple exception class, which stores a human-readable error description.
Abstract sample generator.
virtual float next1D()=0
Retrieve the next component value from the current sample.
static float squareToUniformDiskPdf(const Point2f &p)
Probability density of squareToUniformDisk()
static Vector3f sampleUniformHemisphere(Sampler *sampler, const Normal3f &northPole)
Uniformly sample a vector on the unit hemisphere with respect to solid angles (naive implementation)
static float squareToUniformHemispherePdf(const Vector3f &v)
Probability density of squareToUniformHemisphere()
static float squareToUniformSphereCapPdf(const Vector3f &v, float cosThetaMax)
Probability density of squareToUniformSphereCap()
static Point2f squareToUniformSquare(const Point2f &sample)
Dummy warping function: takes uniformly distributed points in a square and just returns them.
static Vector3f squareToCosineHemisphere(const Point2f &sample)
Uniformly sample a vector on the unit hemisphere around the pole (0,0,1) with respect to projected so...
static Vector3f squareToBeckmann(const Point2f &sample, float alpha)
Warp a uniformly distributed square sample to a Beckmann distribution * cosine for the given 'alpha' ...
static Vector3f squareToUniformSphere(const Point2f &sample)
Uniformly sample a vector on the unit sphere with respect to solid angles.
static float squareToCosineHemispherePdf(const Vector3f &v)
Probability density of squareToCosineHemisphere()
static Vector3f squareToUniformHemisphere(const Point2f &sample)
Uniformly sample a vector on the unit hemisphere around the pole (0,0,1) with respect to solid angles...
static Point2f squareToUniformDisk(const Point2f &sample)
Uniformly sample a vector on a 2D disk with radius 1, centered around the origin.
static float squareToBeckmannPdf(const Vector3f &m, float alpha)
Probability density of squareToBeckmann()
static Vector3f squareToUniformSphereCap(const Point2f &sample, float cosThetaMax)
Uniformly sample a vector on a spherical cap around (0, 0, 1)
static float squareToUniformSpherePdf(const Vector3f &v)
Probability density of squareToUniformSphere()
static float squareToUniformSquarePdf(const Point2f &p)
Probability density of squareToUniformSquare()
3-dimensional surface normal representation