Add Framwork for Assignment 3
This commit is contained in:
parent
a2d7f5c414
commit
c864d2a42f
14 changed files with 50048 additions and 48111 deletions
|
|
@ -107,6 +107,37 @@ inline Vec3fa uniformSampleCone(const float cosAngle, const Vec2f &s)
|
|||
return cartesian(phi, cosTheta);
|
||||
}
|
||||
|
||||
inline float erfInv(float x) {
|
||||
float w, p;
|
||||
x = clamp(x, -.99999f, .99999f);
|
||||
w = -std::log((1 - x) * (1 + x));
|
||||
if (w < 5) {
|
||||
w = w - 2.5f;
|
||||
p = 2.81022636e-08f;
|
||||
p = 3.43273939e-07f + p * w;
|
||||
p = -3.5233877e-06f + p * w;
|
||||
p = -4.39150654e-06f + p * w;
|
||||
p = 0.00021858087f + p * w;
|
||||
p = -0.00125372503f + p * w;
|
||||
p = -0.00417768164f + p * w;
|
||||
p = 0.246640727f + p * w;
|
||||
p = 1.50140941f + p * w;
|
||||
}
|
||||
else {
|
||||
w = std::sqrt(w) - 3;
|
||||
p = -0.000200214257f;
|
||||
p = 0.000100950558f + p * w;
|
||||
p = 0.00134934322f + p * w;
|
||||
p = -0.00367342844f + p * w;
|
||||
p = 0.00573950773f + p * w;
|
||||
p = -0.0076224613f + p * w;
|
||||
p = 0.00943887047f + p * w;
|
||||
p = 1.00167406f + p * w;
|
||||
p = 2.83297682f + p * w;
|
||||
}
|
||||
return p * x;
|
||||
}
|
||||
|
||||
inline float uniformSampleConePDF(const float cosAngle)
|
||||
{
|
||||
return rcp(float(two_pi)*(1.0f - cosAngle));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue