Add jitter to area light and example render of it.

This commit is contained in:
Godzil
2020-03-02 14:03:31 +00:00
parent 1fbe682572
commit 21749695b6
12 changed files with 186 additions and 24 deletions

View File

@@ -47,5 +47,14 @@ double Light::intensityAt(World &w, Tuple point)
Tuple Light::pointOnLight(uint32_t u, uint32_t v)
{
return this->corner + this->uVec * (u+0.5) + this->vVec * (v+0.5);
if (this->jitter)
{
/* For some reason, for the test to pass, I need to get the sequence for V first, then U contrary to what
* the bonus chapter says
*/
return this->corner +
this->vVec * (v + this->jitterBy.next()) +
this->uVec * (u + this->jitterBy.next());
}
return this->corner + this->uVec * (u + 0.5) + this->vVec * (v + 0.5);
}