@@ -23,7 +23,13 @@ Post-processing effects are shaders applied to a frame after Godot has rendered
23
23
it. To apply a shader to a frame, create a :ref: `CanvasLayer
24
24
<class_CanvasLayer>`, and give it a :ref: `ColorRect <class_ColorRect >`. Assign a
25
25
new :ref: `ShaderMaterial <class_ShaderMaterial >` to the newly created
26
- ``ColorRect ``, and set the ``ColorRect ``'s layout to "Full Rect".
26
+ ``ColorRect ``, and set the ``ColorRect ``'s anchor preset to Full Rect:
27
+
28
+ .. figure :: img/custom_postprocessing_anchors_preset_full_rect.webp
29
+ :align: center
30
+ :alt: Setting the anchor preset to Full Rect on the ColorRect node
31
+
32
+ Setting the anchor preset to Full Rect on the ColorRect node
27
33
28
34
Your scene tree will look something like this:
29
35
@@ -67,8 +73,8 @@ shader by `arlez80 <https://bitbucket.org/arlez80/hex-mosaic/src/master/>`_,
67
73
68
74
void fragment() {
69
75
vec2 norm_size = size * SCREEN_PIXEL_SIZE;
70
- bool half = mod(SCREEN_UV.y / 2.0, norm_size.y) / norm_size.y < 0.5;
71
- vec2 uv = SCREEN_UV + vec2(norm_size.x * 0.5 * float(half ), 0.0);
76
+ bool less_than_half = mod(SCREEN_UV.y / 2.0, norm_size.y) / norm_size.y < 0.5;
77
+ vec2 uv = SCREEN_UV + vec2(norm_size.x * 0.5 * float(less_than_half ), 0.0);
72
78
vec2 center_uv = floor(uv / norm_size) * norm_size;
73
79
vec2 norm_uv = mod(uv, norm_size) / norm_size;
74
80
center_uv += mix(vec2(0.0, 0.0),
@@ -78,7 +84,7 @@ shader by `arlez80 <https://bitbucket.org/arlez80/hex-mosaic/src/master/>`_,
78
84
mix(vec2(0.0, -norm_size.y),
79
85
vec2(-norm_size.x, -norm_size.y),
80
86
float(norm_uv.x < 0.5)),
81
- float(half )),
87
+ float(less_than_half )),
82
88
float(norm_uv.y < 0.3333333) * float(norm_uv.y / 0.3333333 < (abs(norm_uv.x - 0.5) * 2.0)));
83
89
84
90
COLOR = textureLod(screen_texture, center_uv, 0.0);
0 commit comments