File tree 1 file changed +7
-2
lines changed
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``.
41
41
Godot handles the transform from model to view space to clip space behind the scenes,
42
42
so we need to nullify the effects of Godot's transformations. We do this by setting the
43
43
``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.
45
45
46
46
.. code-block :: glsl
47
47
48
48
shader_type spatial;
49
49
50
50
void vertex() {
51
- POSITION = vec4(VERTEX, 1.0);
51
+ POSITION = vec4(VERTEX.xy, 1.0 , 1.0);
52
52
}
53
53
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
+
54
59
Even with this vertex shader, the quad keeps disappearing. This is due to frustum
55
60
culling, which is done on the CPU. Frustum culling uses the camera matrix and the
56
61
AABBs 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