#PointLight2D is below my shader. How to fix this ?

8 messages · Page 1 of 1 (latest)

native egret
#

So after trial and error i managed to achieve the effect i wanted with sdf but i have a problem when using PointLight2D , the light look dim . If i were to take a guess that's because the shader is applied after the light ? Anyway here's a screen to give an idea of the problem.

#

shader_type canvas_item;

render_mode unshaded;

uniform vec4 color : source_color;
uniform float margin :hint_range(0.0,20.00,0.5)=10;
uniform float darkness :hint_range(0.1, 0.8, 0.05)=0.3;

void fragment() {

vec2 at = screen_uv_to_sdf(SCREEN_UV);
float da = texture_sdf(at);
vec2 backtouv = -margin*sdf_to_screen_uv(vec2(da,0));

COLOR = vec4(color.rgb,min(darkness,backtouv.x));

}

#

So , how should i fix this ? Thanks for your help .

native egret
#

PointLight2D is below my shader. How to fix this ?

native egret
#

Shameless bump .

native egret
#

Anyone ?
Also , is there a way to stabilize sdf ? what i mean is that when i zoom/ dezoom in the editor the visual representation isn't the same.