Skip to content

Commit

Permalink
CA-89 change sky colour based on Scene
Browse files Browse the repository at this point in the history
  • Loading branch information
connortbot committed Sep 26, 2024
1 parent e10e736 commit 8b735b5
Showing 1 changed file with 1 addition and 3 deletions.
4 changes: 1 addition & 3 deletions src/render.cc
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,10 @@ color trace_ray(const ray& r, std::shared_ptr<Scene> scene, int depth) {
} else if (rayhit.hit.geomID != RTC_INVALID_GEOMETRY_ID) {
targetID = rayhit.hit.geomID;
} else {
// Sky background (gradient blue-white)
vec3 unit_direction = r_in.direction().unit_vector();
auto t = 0.5*(unit_direction.y() + 1.0);

// color sky = color(0,0,0);
color sky = (1.0-t)*color(1.0, 1.0, 1.0) + t*color(0.5, 0.7, 1.0); // lerp formula (1.0-t)*start + t*endval
color sky = (1.0-t)*(scene->sky_top) + t*(scene->sky_bottom); // lerp formula (1.0-t)*start + t*endval
accumulated_color += weight * sky;
return accumulated_color;
}
Expand Down

0 comments on commit 8b735b5

Please sign in to comment.