From f237fddf1fa590d6fed0cccce5168faf27fcd040 Mon Sep 17 00:00:00 2001 From: Jonathan Bernhard Date: Fri, 28 Feb 2025 10:55:15 +0100 Subject: [PATCH] Add info regarding missing depth correction to Camera3D.get_camera_projection documentation --- doc/classes/Camera3D.xml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/doc/classes/Camera3D.xml b/doc/classes/Camera3D.xml index 27194122d56..4a20c06eb67 100644 --- a/doc/classes/Camera3D.xml +++ b/doc/classes/Camera3D.xml @@ -21,6 +21,19 @@ Returns the projection matrix that this camera uses to render to its associated viewport. The camera must be part of the scene tree to function. + [b]Note:[/b] The resulting [Projection] does [i]not[/i] include the depth correction Godot's Vulkan renderer uses internally. To add depth correction, multiply the returned [Projection] by [method Projection.create_depth_correction] with [code]flip_y[/code] set to [code]true[/code]: + [codeblocks] + [gdscript] + var camera_projection: Projection = camera.get_camera_projection() + var correction: Projection = Projection.create_depth_correction(true) + var corrected_camera_projection = correction * camera_projection + [/gdscript] + [csharp] + var cameraProjection = camera.GetCameraProjection(); + var correction = Projection.CreateDepthCorrection(true); + var correctedCameraProjection = correction * cameraProjection; + [/csharp] + [/codeblocks]