shader_type canvas_item;


uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap;


void vertex() {

    // Called for every vertex the material is visible on.

}


uniform float scale_y;


void fragment() {

    float uv_height = SCREEN_PIXEL_SIZE.y / TEXTURE_PIXEL_SIZE.y;

    vec2 reflected_screenuv = vec2(SCREEN_UV.x, SCREEN_UV.y + uv_height * UV.y * -scale_y);

    vec4 reflection = textureLod(SCREEN_TEXTURE,reflected_screenuv, 0.0);

    

    

    COLOR = reflection;

}



화면의 크기에 따라서 scale.y 값을 결정해야함.

uniform float scale_y; < 인스펙터로 변수의 값을 정할 수 있음.


SCREEN_TEXTURE가 3버전에서는 기본으로 내장되어 있었으나 4에서는 따로 지정해야함.

uniform sampler2D SCREEN_TEXTURE : hint_screen_texture, filter_linear_mipmap; < 이렇게 설정하면 됨.



https://www.youtube.com/watch?v=8scpuFtImcw&t=273s&ab_channel=WebGirlKristina