Tonemapping, gotta add colour grading

This commit is contained in:
Ben
2019-09-15 22:09:15 +01:00
parent c14ac13292
commit 8ba434e906
10 changed files with 129 additions and 53 deletions

View File

@@ -77,7 +77,12 @@ glm::vec3 RenderEngine::GetColour(Ray ray, int& depth) {
float t = INFINITY; Primative* hit = nullptr;
bool didhit = TraceRayScene(ray, m_scene, t, hit);
if (!didhit) return m_scene->SampleSky(ray);
if (!didhit) {
if (depth > 0) {
return m_scene->SampleSky(ray) * 0.2f;
}
return m_scene->SampleSky(ray);
}
glm::vec3 hitPoint = ray.origin + ray.direction * t;
glm::vec3 normal = hit->Normal(hitPoint);