File tree Expand file tree Collapse file tree 1 file changed +7
-2
lines changed
Expand file tree Collapse file tree 1 file changed +7
-2
lines changed Original file line number Diff line number Diff line change @@ -41,16 +41,21 @@ of the screen. This is why the QuadMesh needs to have height and width of ``2``.
4141Godot handles the transform from model to view space to clip space behind the scenes,
4242so we need to nullify the effects of Godot's transformations. We do this by setting the
4343``POSITION `` built-in to our desired position. ``POSITION `` bypasses the built-in transformations
44- and sets the vertex position directly.
44+ and sets the vertex position in clip space directly.
4545
4646.. code-block :: glsl
4747
4848 shader_type spatial;
4949
5050 void vertex() {
51- POSITION = vec4(VERTEX, 1.0);
51+ POSITION = vec4(VERTEX.xy, 1.0 , 1.0);
5252 }
5353
54+ .. note :: In versions of Godot earlier than 4.3, this code recommended using ``POSITION = vec4(VERTEX, 1.0);``
55+ which implicitly assumed the clip-space near plane was at ``0.0 ``.
56+ That code is now incorrect and will not work in versions 4.3+ as we
57+ use a "reversed-z" depth buffer now where the near plane is at ``1.0 ``.
58+
5459Even with this vertex shader, the quad keeps disappearing. This is due to frustum
5560culling, which is done on the CPU. Frustum culling uses the camera matrix and the
5661AABBs of Meshes to determine if the Mesh will be visible *before * passing it to the GPU.
You can’t perform that action at this time.
0 commit comments