StreamOverlay/scenes/2DOverlay.tscn

285 lines
8.3 KiB
Plaintext

[gd_scene load_steps=13 format=2]
[ext_resource path="res://Node.tscn" type="PackedScene" id=1]
[ext_resource path="res://scenes/2DOverlay.gd" type="Script" id=2]
[ext_resource path="res://scenes/Overlay Text.tres" type="Theme" id=3]
[ext_resource path="res://sprites/Mara.png" type="Texture" id=4]
[ext_resource path="res://scenes/GlitchyTexture.tres" type="Material" id=5]
[sub_resource type="Shader" id=8]
code = "shader_type canvas_item;
uniform float battery : hint_range(0.0,1.0) = 1.0;
uniform float anchor : hint_range(-1.0,1.0) = -0.5;
uniform float speed_scale : hint_range(1.0, 10.0) = 1.0;
uniform float fov : hint_range(0.01, 1.0) = 0.2;
uniform vec4 background_color : hint_color = vec4(0.0, 0.1, 0.2, 1.0);
uniform vec4 grid_color : hint_color = vec4(1.0, 0.5, 1.0, 1.0);
float grid(vec2 uv, float batt) {
vec2 size = vec2(uv.y, uv.y * uv.y * 0.2) * 0.01;
uv += vec2(0.0, TIME * speed_scale * (batt + 0.05));
uv = abs(fract(uv) - 0.5);
vec2 lines = smoothstep(size, vec2(0.0), uv);
lines += smoothstep(size * 5.0, vec2(0.0), uv) * 0.4 * batt;
return clamp(lines.x + lines.y, 0.0, 3.0);
}
void fragment() {
vec2 uv = UV;
vec4 col = background_color;
uv.y = 3.0 / (abs(uv.y + fov) + 0.05);
uv.x += anchor;
uv.x *= uv.y * 1.0;
float gridVal = grid(uv, battery);
col = mix(background_color, grid_color, gridVal);
COLOR = col;
}"
[sub_resource type="ShaderMaterial" id=9]
shader = SubResource( 8 )
shader_param/battery = 1.0
shader_param/anchor = -0.5
shader_param/speed_scale = 1.0
shader_param/fov = 0.2
shader_param/background_color = Color( 0, 0.1, 0.2, 1 )
shader_param/grid_color = Color( 1, 0.5, 1, 1 )
[sub_resource type="Shader" id=10]
code = "// cloudy skies shader
// inspired from shadertoy shader made by Drift (https://www.shadertoy.com/view/4tdSWr)
shader_type canvas_item;
uniform float cloudscale = 1.1;
uniform float speed = 0.01;
uniform float clouddark = 0.5;
uniform float cloudlight = 0.3;
uniform float cloudcover = 0.2;
uniform float cloudalpha = 8.0;
uniform float skytint = 0.5;
uniform vec3 skycolour1 = vec3(0.2, 0.4, 0.6);
uniform vec3 skycolour2 = vec3(0.4, 0.7, 1.0);
uniform mat2 m = mat2(vec2(1.6,1.2),vec2(-1.2,1.6)); // changement
// functions
vec2 hash( vec2 p ) {
p = vec2(dot(p,vec2(127.1,311.7)), dot(p,vec2(269.5,183.3)));
return -1.0 + 2.0*fract(sin(p)*43758.5453123);
}
float noise( in vec2 p ) {
float K1 = 0.366025404; // (sqrt(3)-1)/2;
float K2 = 0.211324865; // (3-sqrt(3))/6;
vec2 i = floor(p + (p.x+p.y)*K1);
vec2 a = p - i + (i.x+i.y)*K2;
vec2 o = (a.x>a.y) ? vec2(1.0,0.0) : vec2(0.0,1.0); //vec2 of = 0.5 + 0.5*vec2(sign(a.x-a.y), sign(a.y-a.x));
vec2 b = a - o + K2;
vec2 c = a - 1.0 + 2.0*K2;
vec3 h = max(0.5-vec3(dot(a,a), dot(b,b), dot(c,c) ), 0.0 );
vec3 n = h*h*h*h*vec3( dot(a,hash(i+0.0)), dot(b,hash(i+o)), dot(c,hash(i+1.0)));
return dot(n, vec3(70.0));
}
float fbm(vec2 n) {
float total = 0.0, amplitude = 0.1;
for (int i = 0; i < 7; i++) {
total += noise(n) * amplitude;
n = m * n;
amplitude *= 0.4;
}
return total;
}
// fragment shader
void fragment() {
vec2 res = 1.0 / SCREEN_PIXEL_SIZE;
vec2 p = FRAGCOORD.xy / res.xy; // changement
vec2 uv = p*vec2(res.x/res.y,1.0); // changement
float time = TIME * speed ;
float q = fbm(uv * cloudscale * 0.5);
//ridged noise shape
float r = 0.0;
uv *= cloudscale;
uv += q - time;
float weight = 0.8;
for (int i=0; i<8; i++){
r += abs(weight*noise( uv ));
uv = m*uv + time;
weight *= 0.7;
}
//noise shape
float f = 0.0;
uv = p*vec2(res.x/res.y,1.0); // changement
uv *= cloudscale;
uv += q - time;
weight = 0.7;
for (int i=0; i<8; i++){
f += weight*noise( uv );
uv = m*uv + time;
weight *= 0.6;
}
f *= r + f;
//noise colour
float c = 0.0;
time = TIME * speed * 2.0;
uv = p*vec2(res.x/res.y,1.0); // changement
uv *= cloudscale*2.0;
uv += q - time;
weight = 0.4;
for (int i=0; i<7; i++){
c += weight*noise( uv );
uv = m*uv + time;
weight *= 0.6;
}
//noise ridge colour
float c1 = 0.0;
time = TIME * speed * 3.0;
uv = p*vec2(res.x/res.y,1.0);
uv *= cloudscale*3.0;
uv += q - time;
weight = 0.4;
for (int i=0; i<7; i++){
c1 += abs(weight*noise( uv ));
uv = m*uv + time;
weight *= 0.6;
}
c += c1;
vec3 skycolour = mix(skycolour2, skycolour1, p.y);
vec3 cloudcolour = vec3(1.1, 1.1, 0.9) * clamp((clouddark + cloudlight*c), 0.0, 1.0);
f = cloudcover + cloudalpha*f*r;
vec3 result = mix(skycolour, clamp(skytint * skycolour + cloudcolour, 0.0, 1.0), clamp(f + c, 0.0, 1.0));
COLOR.rgb = vec3(result);
}
"
[sub_resource type="ShaderMaterial" id=11]
shader = SubResource( 10 )
shader_param/cloudscale = 1.1
shader_param/speed = 0.01
shader_param/clouddark = 0.5
shader_param/cloudlight = 0.3
shader_param/cloudcover = 0.15
shader_param/cloudalpha = 2.0
shader_param/skytint = 1.0
shader_param/skycolour1 = Vector3( 0.2, 0.4, 0.6 )
shader_param/skycolour2 = Vector3( 0.4, 0.7, 1 )
shader_param/m = Transform2D( 1.6, -1.2, 1.2, 1.6, 0, 0 )
[sub_resource type="AtlasTexture" id=4]
atlas = ExtResource( 4 )
region = Rect2( 0, 0, 16, 16 )
[sub_resource type="AtlasTexture" id=5]
atlas = ExtResource( 4 )
region = Rect2( 16, 0, 16, 16 )
[sub_resource type="SpriteFrames" id=3]
animations = [ {
"frames": [ SubResource( 4 ), SubResource( 5 ) ],
"loop": true,
"name": "down",
"speed": 1.0
} ]
[node name="Overlay" type="Node2D"]
script = ExtResource( 2 )
[node name="Panel" type="Panel" parent="."]
material = SubResource( 9 )
margin_right = 1920.0
margin_bottom = 1079.0
[node name="Panel2" type="Panel" parent="."]
modulate = Color( 1, 1, 1, 0.376471 )
material = SubResource( 11 )
margin_right = 1920.0
margin_bottom = 1079.0
[node name="Chatbox" parent="." instance=ExtResource( 1 )]
margin_left = 1278.0
margin_right = 1599.0
margin_bottom = 259.0
rect_scale = Vector2( 2, 2 )
[node name="Facecam" type="ColorRect" parent="."]
visible = false
margin_left = 1280.0
margin_top = 518.0
margin_right = 1920.0
margin_bottom = 1079.0
color = Color( 0, 1, 0.835294, 1 )
[node name="Screen" type="ColorRect" parent="."]
margin_right = 1280.0
margin_bottom = 720.0
rect_min_size = Vector2( 720, 0 )
color = Color( 0, 0, 1, 1 )
[node name="HBoxContainer" type="HBoxContainer" parent="."]
margin_left = 18.0
margin_top = 720.0
margin_right = 1281.0
margin_bottom = 1080.0
rect_min_size = Vector2( 720, 0 )
[node name="VBoxContainer2" type="VBoxContainer" parent="HBoxContainer"]
visible = false
margin_bottom = 360.0
[node name="ColorRect" type="ColorRect" parent="HBoxContainer/VBoxContainer2"]
margin_right = 340.0
margin_bottom = 360.0
[node name="VBoxContainer" type="VBoxContainer" parent="HBoxContainer"]
margin_right = 316.0
margin_bottom = 360.0
[node name="Stream" type="Label" parent="HBoxContainer/VBoxContainer"]
margin_right = 316.0
margin_bottom = 39.0
theme = ExtResource( 3 )
text = "twitch: princessxen"
[node name="Twitter" type="Label" parent="HBoxContainer/VBoxContainer"]
margin_top = 43.0
margin_right = 316.0
margin_bottom = 82.0
theme = ExtResource( 3 )
text = "twitter: @theprincessxena"
[node name="Website" type="Label" parent="HBoxContainer/VBoxContainer"]
margin_top = 86.0
margin_right = 316.0
margin_bottom = 125.0
theme = ExtResource( 3 )
text = "https://xeiaso.net"
[node name="Patrone" type="Label" parent="HBoxContainer/VBoxContainer"]
margin_top = 129.0
margin_right = 316.0
margin_bottom = 168.0
theme = ExtResource( 3 )
text = "https://patreon.com/cadey"
[node name="Mara" type="AnimatedSprite" parent="HBoxContainer/VBoxContainer"]
material = ExtResource( 5 )
position = Vector2( 165, 263 )
scale = Vector2( 10, 10 )
frames = SubResource( 3 )
animation = "down"
frame = 1
playing = true