Add shine shader on flag

This commit is contained in:
Fabien Freling 2018-08-27 14:04:36 +02:00
parent 0adef2f250
commit 06bf7bf2ae
2 changed files with 10 additions and 9 deletions

View file

@ -5,9 +5,6 @@
[ext_resource path="res://scenes/Goal.tscn" type="PackedScene" id=3] [ext_resource path="res://scenes/Goal.tscn" type="PackedScene" id=3]
[ext_resource path="res://levels/Level_01_env.tres" type="Environment" id=4] [ext_resource path="res://levels/Level_01_env.tres" type="Environment" id=4]
[node name="Level_01" type="Node" index="0"] [node name="Level_01" type="Node" index="0"]
[node name="GridMap" type="GridMap" parent="." index="0"] [node name="GridMap" type="GridMap" parent="." index="0"]

View file

@ -7,7 +7,7 @@
extents = Vector3( 0.584547, 2.22627, 0.659734 ) extents = Vector3( 0.584547, 2.22627, 0.659734 )
[sub_resource type="Shader" id=6] [sub_resource type="Shader" id=2]
code = "shader_type spatial; code = "shader_type spatial;
@ -18,14 +18,18 @@ code = "shader_type spatial;
//} //}
void fragment() { void fragment() {
ALBEDO = vec3(1.0, 0.0, 0.0); // use red for material albedo; float max_dist = 0.5; // maximum orthogonal distance from center in a [0,1] rectangle
// distance from the center, normalized on [0,1]
float center_dist = sqrt(pow(UV.x - 0.5, 2) + pow(UV.y - 0.5, 2)) / max_dist;
ALBEDO = vec3(1.0, 1.0, 0);
ALPHA = max(1.0 - center_dist, 0.0);
} }
" "
[sub_resource type="ShaderMaterial" id=7] [sub_resource type="ShaderMaterial" id=3]
render_priority = 0 render_priority = 0
shader = SubResource( 6 ) shader = SubResource( 2 )
[sub_resource type="Gradient" id=4] [sub_resource type="Gradient" id=4]
@ -39,7 +43,7 @@ gradient = SubResource( 4 )
width = 2 width = 2
_sections_unfolded = [ "Resource" ] _sections_unfolded = [ "Resource" ]
[node name="Scene Root" index="0" instance=ExtResource( 1 )] [node name="Scene Root" instance=ExtResource( 1 )]
script = ExtResource( 2 ) script = ExtResource( 2 )
@ -99,7 +103,7 @@ disabled = false
transform = Transform( 250, 0, 0, 0, 500, 0, 0, 0, 1, 0, 0, 0 ) transform = Transform( 250, 0, 0, 0, 500, 0, 0, 0, 1, 0, 0, 0 )
layers = 1 layers = 1
material_override = SubResource( 7 ) material_override = SubResource( 3 )
cast_shadow = 1 cast_shadow = 1
extra_cull_margin = 0.0 extra_cull_margin = 0.0
use_in_baked_light = false use_in_baked_light = false