From aee190077d17e5364e558a90f8a8d108831cf6ad Mon Sep 17 00:00:00 2001 From: Nelson Sexton Date: Sun, 7 Sep 2025 17:04:22 -0600 Subject: [PATCH 1/2] Add Z_CLIP_SCALE to Spatial Shaders reference vertex built-ins MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This feature was originally implemented in: https://github.com/godotengine/godot/pull/93142 I attempted to match the brevity of the other descriptions, shortening the description from the Material 3D class reference: https://docs.godotengine.org/en/latest/classes/class_basematerial3d.html#class-basematerial3d-property-z-clip-scale First docs contribution 🤞 hope I did ok! --- tutorials/shaders/shader_reference/spatial_shader.rst | 3 +++ 1 file changed, 3 insertions(+) diff --git a/tutorials/shaders/shader_reference/spatial_shader.rst b/tutorials/shaders/shader_reference/spatial_shader.rst index 53e986ad0ec..bcf036627da 100644 --- a/tutorials/shaders/shader_reference/spatial_shader.rst +++ b/tutorials/shaders/shader_reference/spatial_shader.rst @@ -266,6 +266,9 @@ shader, this value can be used as desired. +----------------------------------------+--------------------------------------------------------+ | in vec4 **CUSTOM3** | Custom value from vertex primitive. | +----------------------------------------+--------------------------------------------------------+ +| out float **Z_CLIP_SCALE** | If written to, scales the vertex towards the camera to | +| | avoid clipping into things like walls. | ++----------------------------------------+--------------------------------------------------------+ .. note:: From aed1938905d850efc367796453bc1a9accffc74b Mon Sep 17 00:00:00 2001 From: Nelson Sexton Date: Tue, 9 Sep 2025 12:30:26 -0600 Subject: [PATCH 2/2] Update tutorials/shaders/shader_reference/spatial_shader.rst Co-authored-by: Hugo Locurcio --- tutorials/shaders/shader_reference/spatial_shader.rst | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tutorials/shaders/shader_reference/spatial_shader.rst b/tutorials/shaders/shader_reference/spatial_shader.rst index bcf036627da..e34582b176b 100644 --- a/tutorials/shaders/shader_reference/spatial_shader.rst +++ b/tutorials/shaders/shader_reference/spatial_shader.rst @@ -268,6 +268,10 @@ shader, this value can be used as desired. +----------------------------------------+--------------------------------------------------------+ | out float **Z_CLIP_SCALE** | If written to, scales the vertex towards the camera to | | | avoid clipping into things like walls. | +| | Lighting and shadows will continue to work correctly | +| | when this is written to, but screen-space effects like | +| | SSAO and SSR may break with lower scales. Try to keep | +| | this value as close to ``1.0`` as possible. | +----------------------------------------+--------------------------------------------------------+ .. note::