diff --git a/engine/math/src/transform.cpp b/engine/math/src/transform.cpp index 7e10998..cceffe4 100755 --- a/engine/math/src/transform.cpp +++ b/engine/math/src/transform.cpp @@ -31,9 +31,9 @@ Matrix4x4 transform::infinite_perspective(const float field_of_view, const float Matrix4x4 result(0.0f); result[0][0] = (2.0f * z_near) / (right - left); result[1][1] = (2.0f * z_near) / (top - bottom); - result[2][2] = 1.0f; + result[2][2] = 1.0f - std::numeric_limits::epsilon(); // prevent NaN result[2][3] = 1.0f; - result[3][2] = -2.0 * z_near; + result[3][2] = -(2.0 - std::numeric_limits::epsilon()) * z_near; return result; } diff --git a/engine/renderer/src/renderer.cpp b/engine/renderer/src/renderer.cpp index ada9da5..b7ba23b 100755 --- a/engine/renderer/src/renderer.cpp +++ b/engine/renderer/src/renderer.cpp @@ -683,7 +683,6 @@ void Renderer::create_mesh_pipeline(Material& material) { pipelineInfo.render_pass = offscreenRenderPass; pipelineInfo.depth.depth_mode = GFXDepthMode::Less; pipelineInfo.rasterization.culling_mode = GFXCullingMode::Backface; - //pipelineInfo.blending.enable_blending = true; pipelineInfo.blending.src_rgb = GFXBlendFactor::SrcAlpha; pipelineInfo.blending.dst_rgb = GFXBlendFactor::OneMinusSrcAlpha; diff --git a/tools/common/src/commoneditor.cpp b/tools/common/src/commoneditor.cpp index a346284..9f705f8 100755 --- a/tools/common/src/commoneditor.cpp +++ b/tools/common/src/commoneditor.cpp @@ -193,8 +193,7 @@ void CommonEditor::update(float deltaTime) { Vector4 ray_start = view_proj_inverse * Vector4(n.x, n.y, 0.0f, 1.0f); ray_start *= 1.0f / ray_start.w; - // note: we take the lowest visible floating point below 1.0 because we use infinite perspective martrix. if we simply inserted 1.0, then it would return NaN - Vector4 ray_end = view_proj_inverse * Vector4(n.x, n.y, 1.0f - std::numeric_limits::epsilon(), 1.0f); + Vector4 ray_end = view_proj_inverse * Vector4(n.x, n.y, 1.0f, 1.0f); ray_end *= 1.0f / ray_end.w; Ray camera_ray;