remove old water_bomb_model, put shaders into /assets/
This commit is contained in:
14
assets/shaders/interactivity_outline.gdshader
Normal file
14
assets/shaders/interactivity_outline.gdshader
Normal file
@ -0,0 +1,14 @@
|
||||
shader_type spatial;
|
||||
render_mode blend_mix, cull_front, unshaded;
|
||||
|
||||
uniform vec4 color : source_color = vec4(1,0,0,1);
|
||||
uniform float size : hint_range(1.0, 1.5, 0.01) = 1.05;
|
||||
|
||||
void vertex() {
|
||||
VERTEX *= size;
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
ALBEDO = color.rgb;
|
||||
ALPHA = color.a;
|
||||
}
|
32
assets/shaders/interactivity_outline2.gdshader
Normal file
32
assets/shaders/interactivity_outline2.gdshader
Normal file
@ -0,0 +1,32 @@
|
||||
shader_type spatial;
|
||||
|
||||
|
||||
uniform float width : hint_range(0.0, 16.0);
|
||||
uniform vec4 outline_color : source_color;
|
||||
uniform sampler2D albedo_texture : source_color, filter_nearest;
|
||||
|
||||
|
||||
void vertex() {
|
||||
MODELVIEW_MATRIX = VIEW_MATRIX * mat4(INV_VIEW_MATRIX[0], vec4(0, 1, 0, 0), INV_VIEW_MATRIX[2], MODEL_MATRIX[3]);
|
||||
}
|
||||
|
||||
/* thanks gdquest */
|
||||
void fragment() {
|
||||
vec2 size = vec2(width) / vec2(textureSize(albedo_texture, 0));
|
||||
|
||||
vec4 sprite_color = texture(albedo_texture, UV);
|
||||
|
||||
float alpha = sprite_color.a;
|
||||
alpha += texture(albedo_texture, UV + vec2(0.0, -size.y)).a;
|
||||
alpha += texture(albedo_texture, UV + vec2(size.x, -size.y)).a;
|
||||
alpha += texture(albedo_texture, UV + vec2(size.x, 0.0)).a;
|
||||
alpha += texture(albedo_texture, UV + vec2(size.x, size.y)).a;
|
||||
alpha += texture(albedo_texture, UV + vec2(0.0, size.y)).a;
|
||||
alpha += texture(albedo_texture, UV + vec2(-size.x, size.y)).a;
|
||||
alpha += texture(albedo_texture, UV + vec2(-size.x, 0.0)).a;
|
||||
alpha += texture(albedo_texture, UV + vec2(-size.x, -size.y)).a;
|
||||
|
||||
vec3 final_color = mix(outline_color.rgb, sprite_color.rgb, sprite_color.a);
|
||||
ALBEDO = final_color;
|
||||
ALPHA = clamp(alpha, 0.0, 1.0);
|
||||
}
|
@ -1,6 +1,6 @@
|
||||
[gd_resource type="StandardMaterial3D" load_steps=3 format=3 uid="uid://ruycqsmlhsiw"]
|
||||
|
||||
[ext_resource type="Shader" path="res://scenes/interactivity_outline.gdshader" id="1_nmq18"]
|
||||
[ext_resource type="Shader" path="res://assets/shaders/interactivity_outline.gdshader" id="1_nmq18"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_gi5rt"]
|
||||
resource_local_to_scene = true
|
||||
|
@ -1,6 +1,6 @@
|
||||
[gd_resource type="StandardMaterial3D" load_steps=3 format=3 uid="uid://cm6b807gcxn4w"]
|
||||
|
||||
[ext_resource type="Shader" path="res://scenes/interactivity_outline.gdshader" id="1_wfrf5"]
|
||||
[ext_resource type="Shader" path="res://assets/shaders/interactivity_outline.gdshader" id="1_wfrf5"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_phi16"]
|
||||
resource_local_to_scene = true
|
||||
|
Reference in New Issue
Block a user