diff --git a/shaders/debug.glsl b/shaders/debug.glsl index 4003a4e..4b98fec 100644 --- a/shaders/debug.glsl +++ b/shaders/debug.glsl @@ -246,7 +246,7 @@ hitInfo traverseBVHs(Ray ray, inout Stats stats) hitInfo temp_hit = traceBVH(transformedRay, BvhData[i], stats); - float transformed_t = temp_hit.t / bvh_data.scale; + float transformed_t = temp_hit.t * (1.0 / bvh_data.scale); if (transformed_t < hit.t) { GPUTriangle triangle = triangles[temp_hit.obj_index]; @@ -322,8 +322,8 @@ void main() if (pixel_coords.x >= int(u_resolution.x) || pixel_coords.y >= int(u_resolution.y)) return; - vec2 uv = ((vec2(pixel_coords)) / u_resolution) * 2.0 - 1.0;; - uv.x *= u_resolution.x / u_resolution.y; + vec2 uv = ((vec2(pixel_coords)) * (1.0 / u_resolution)) * 2.0 - 1.0;; + uv.x *= u_resolution.x * (1.0 / u_resolution.y); vec3 color = debugColor(uv); diff --git a/shaders/denoising.glsl b/shaders/denoising.glsl index b0d0c71..2c909fd 100644 --- a/shaders/denoising.glsl +++ b/shaders/denoising.glsl @@ -67,7 +67,7 @@ void main() totalWeight += weight; } } - light /= totalWeight; + light * (1.0 / totalWeight); if (u_pass == u_pass_count - 1) { vec4 color = light * imageLoad(color_texture, pixel_coords); diff --git a/srcs/class/Camera.cpp b/srcs/class/Camera.cpp index 994ced3..585e6ea 100644 --- a/srcs/class/Camera.cpp +++ b/srcs/class/Camera.cpp @@ -112,7 +112,7 @@ int Camera::portalTeleport(Scene *scene, float delta_time, Renderer &renderer) float distance_future_pos = glm::length(future_pos - _position); float distance_portal = glm::length(point_projected - _position); - float imprecision = 0.1f; + float imprecision = 0.101f; if (distance_portal <= distance_future_pos && glm::dot(glm::normalize(future_pos - _position), obj.normal) > 0.0f) { std::cout << "Teleport" << std::endl;