All I want is to be able to get the UV coordinate of the centre of a mesh (in this case, to take the colour from). However, in the code below, it gets the UV coordinate of the bottom right corner for some reason.
shader_type spatial;
render_mode unshaded;
uniform sampler2D screen_texture : hint_screen_texture;
uniform vec2 tiling = vec2(1.0);
uniform vec2 offset = vec2(0.0);
varying vec2 mesh_position;
void vertex() {
mesh_position = (PROJECTION_MATRIX * vec4(NODE_POSITION_VIEW, 1.0)).xy;
}
void fragment() {
vec2 centre = mesh_position;
vec2 local_uv = (SCREEN_UV);
// Adjust for aspect ratio and FOV
//local_uv.x *= VIEWPORT_SIZE.x / VIEWPORT_SIZE.y;
//local_uv *= -1.0 / PROJECTION_MATRIX[1][1];
ALBEDO = texture(screen_texture, NODE_POSITION_VIEW.xy).rgb;
}