Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | catafest |
I think the problem is this line : vec4(texscreen(zoomed),1.0)
I try to convert with the new docs …
This is the lens shader :
shader_type canvas_item;
render_mode blend_mix;
uniform vec2 mouse_pos = vec2(0.0,0.0);
uniform float aspect_ratios = 1.0;
vec2 zoom_point(vec2 uv, vec2 point, float zoom) {
return (uv - point) / zoom * point;
}
void fragment() {
vec2 uv = SCREEN_UV;
float lens_radius = 0.08;
float mouse_dist = distance(uv*vec2(1.0,aspect_ratios),mouse_pos*vec2(1.0,aspect_ratios));
if (mouse_dist < lens_radius + 0.004) {
COLOR = vec4(0.0,0.0,0.0,1.0);
}
if (mouse_dist < lens_radius) {
float zoom = 2.0;
vec2 zoomed = zoom_point(uv, mouse_pos, zoom);
COLOR = vec4(texscreen(zoomed),1.0);
// not working with the next row
//COLOR = textureLod(SCREEN_TEXTURE, zoomed, 1.0).rgba;
}
}