thanks for the reply,
Using "multiple Sprite nodes behind the main sprite, with a diferent color in order to give an outline effect" its the same thing the shader is doing in code ?
Could the shader be added in code in a node2D ?
Ive tried doing although maybe important thing are missing like draw_texture rotation degrees ?
extends Node2D
var sprite1 = preload('res://sprites/spr_BaseTESTE.png');
var sprite2 = preload('res://sprites/PlayerAllAnimsFinal.png');
func _draw():
draw_texture(sprite1, Vector2(position.x, position.y));
draw_texture(sprite2, Vector2(position.x, position.y));
anyway i manage to get it working with a better version of the shader
this way it seems to draw the line correctly around the filter image...
!
! shader_type canvas_item;
!
! uniform float width : hint_range(0.0, 10.0);
! uniform vec4 outline_color : hint_color;
!
! void fragment()
! {
! vec2 size = vec2(width) / vec2(textureSize(TEXTURE, 0));
! vec4 sprite_color = texture(TEXTURE, UV);
!
! float alpha = sprite_color.a;
! alpha += texture(TEXTURE, UV + vec2(0.0, -size.y)).a;
! alpha += texture(TEXTURE, UV + vec2(size.x, -size.y)).a;
! alpha += texture(TEXTURE, UV + vec2(size.x, 0.0)).a;
! alpha += texture(TEXTURE, UV + vec2(size.x, size.y)).a;
! alpha += texture(TEXTURE, UV + vec2(0.0, size.y)).a;
! alpha += texture(TEXTURE, UV + vec2(-size.x, size.y)).a;
! alpha += texture(TEXTURE, UV + vec2(-size.x, 0.0)).a;
! alpha += texture(TEXTURE, UV + vec2(-size.x, -size.y)).a;
!
! vec3 final_color = mix(outline_color.rgb, sprite_color.rgb, sprite_color.a);
! COLOR = vec4(final_color, clamp(alpha, 0.0, 1.0));
! }
!
!
But combining muitiple sprites with an outLine shader seems a confusing process... Once the sprites are in a viewPort they will lose the filter... The only way to get filter back is use a sprite with a view port texture anywere in the tree...
maybe there is a simpler solution to make this entire process.. ?