Add postprocessing shaders
This commit is contained in:
parent
17df7a1c01
commit
0bffc08a7f
19
Shaders/gba.gdshader
Normal file
19
Shaders/gba.gdshader
Normal file
|
@ -0,0 +1,19 @@
|
|||
shader_type canvas_item;
|
||||
|
||||
uniform float line_opacity : hint_range(0.0,1.0) = 0.5;
|
||||
uniform int spacing = 2;
|
||||
uniform float scale = 1.0;
|
||||
|
||||
void fragment() {
|
||||
vec2 uv = mod((FRAGCOORD.xy / scale) * TEXTURE_PIXEL_SIZE.xy, float(spacing));
|
||||
vec4 color = vec4(COLOR.rgb, 0.0);
|
||||
if(int(uv.y) == 0) {
|
||||
color.a = line_opacity;
|
||||
}
|
||||
COLOR = color;
|
||||
}
|
||||
|
||||
//void light() {
|
||||
// Called for every pixel for every light affecting the CanvasItem.
|
||||
// Uncomment to replace the default light processing function with this one.
|
||||
//}
|
43
Shaders/gba_colors.gdshader
Normal file
43
Shaders/gba_colors.gdshader
Normal file
|
@ -0,0 +1,43 @@
|
|||
shader_type canvas_item;
|
||||
|
||||
uniform sampler2D screen_texture : hint_screen_texture, repeat_disable, filter_nearest;
|
||||
|
||||
uniform float darken_screen;
|
||||
const float display_gamma = 2.5;
|
||||
const float target_gamma = 2.2;
|
||||
const float sat = 1.0;
|
||||
const float lum = 0.99;
|
||||
const float contrast = 1.0;
|
||||
|
||||
const vec3 bl = vec3(0.0, 0.0, 0.0);
|
||||
const vec3 r = vec3(0.84, 0.09, 0.15);
|
||||
const vec3 g = vec3(0.18, 0.67, 0.10);
|
||||
const vec3 b = vec3(0.0, 0.26, 0.73);
|
||||
|
||||
void fragment() {
|
||||
vec4 screen = pow(texture(screen_texture, SCREEN_UV), vec4(target_gamma + darken_screen)).rgba;
|
||||
vec4 avglum = vec4(0.5);
|
||||
screen = mix(screen, avglum, (1.0 - contrast));
|
||||
|
||||
mat4 color_mat = mat4(
|
||||
vec4(r, 0.0),
|
||||
vec4(g, 0.0),
|
||||
vec4(b, 0.0),
|
||||
vec4(bl, 1.0)
|
||||
);
|
||||
mat4 adjust = mat4(
|
||||
vec4((1.0 - sat) * 0.3086 + sat, (1.0 - sat) * 0.3086, (1.0 - sat) * 0.3086, 1.0),
|
||||
vec4((1.0 - sat) * 0.6094, (1.0 - sat) * 0.6094 + sat, (1.0 - sat) * 0.6094, 1.0),
|
||||
vec4((1.0 - sat) * 0.0820, (1.0 - sat) * 0.0820, (1.0 - sat) * 0.0820 + sat, 1.0),
|
||||
vec4(0.0, 0.0, 0.0, 1.0)
|
||||
);
|
||||
color_mat *= adjust;
|
||||
screen = clamp(screen * lum, 0.0, 1.0);
|
||||
screen = color_mat * screen;
|
||||
COLOR = pow(screen, vec4(1.0 / display_gamma + (darken_screen * 0.125)));
|
||||
}
|
||||
|
||||
//void light() {
|
||||
// Called for every pixel for every light affecting the CanvasItem.
|
||||
// Uncomment to replace the default light processing function with this one.
|
||||
//}
|
19
Shaders/lcd.gdshader
Normal file
19
Shaders/lcd.gdshader
Normal file
|
@ -0,0 +1,19 @@
|
|||
shader_type canvas_item;
|
||||
|
||||
uniform float line_opacity : hint_range(0.0,1.0) = 0.25;
|
||||
uniform int spacing = 2;
|
||||
uniform float scale = 1.0;
|
||||
|
||||
void fragment() {
|
||||
vec2 uv = mod((FRAGCOORD.xy / scale) * TEXTURE_PIXEL_SIZE.xy, float(spacing));
|
||||
vec4 color = vec4(COLOR.rgb, 0.0);
|
||||
if(int(uv.y) == 0 || int(uv.x) == 0) {
|
||||
color.a = line_opacity;
|
||||
}
|
||||
COLOR = color;
|
||||
}
|
||||
|
||||
//void light() {
|
||||
// Called for every pixel for every light affecting the CanvasItem.
|
||||
// Uncomment to replace the default light processing function with this one.
|
||||
//}
|
|
@ -24,6 +24,7 @@ Globals="*res://Scripts/globals.gd"
|
|||
window/size/viewport_width=720
|
||||
window/size/viewport_height=480
|
||||
window/stretch/mode="viewport"
|
||||
window/stretch/scale_mode="integer"
|
||||
|
||||
[editor]
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
[gd_scene load_steps=51 format=3 uid="uid://bxuxjqxxqy7ce"]
|
||||
[gd_scene load_steps=57 format=3 uid="uid://bxuxjqxxqy7ce"]
|
||||
|
||||
[ext_resource type="PackedScene" uid="uid://di21xheryhp0k" path="res://Hiro/hiro_player.tscn" id="1_c1gpq"]
|
||||
[ext_resource type="PackedScene" uid="uid://b8sfype1vx5ad" path="res://Nem/nem_npc.tscn" id="1_sqt7d"]
|
||||
|
@ -33,8 +33,11 @@
|
|||
[ext_resource type="Texture2D" uid="uid://baw6gijyxv1fv" path="res://NPCs/npc5.png" id="15_ppm1i"]
|
||||
[ext_resource type="Script" path="res://Scripts/lerping_camera.gd" id="16_6jycw"]
|
||||
[ext_resource type="Texture2D" uid="uid://bcvxfjlg8mmjr" path="res://NPCs/npc6.png" id="16_cgyrp"]
|
||||
[ext_resource type="Shader" path="res://Shaders/gba_colors.gdshader" id="19_5m168"]
|
||||
[ext_resource type="Script" path="res://Scripts/Cutscenes/manager.gd" id="19_5yvrq"]
|
||||
[ext_resource type="Shader" path="res://Shaders/lcd.gdshader" id="20_u7jh7"]
|
||||
[ext_resource type="PackedScene" uid="uid://bwrwh5of0jw4a" path="res://Reed/reed_ai.tscn" id="21_dioix"]
|
||||
[ext_resource type="Shader" path="res://Shaders/gba.gdshader" id="24_2se80"]
|
||||
[ext_resource type="PackedScene" uid="uid://81jm7ixvk25n" path="res://Audio/music_manager.tscn" id="24_03wyf"]
|
||||
[ext_resource type="Script" path="res://Scripts/game_state.gd" id="24_6ypry"]
|
||||
[ext_resource type="PackedScene" uid="uid://bbybt6r6351yp" path="res://Audio/sound_manager.tscn" id="25_hm8b0"]
|
||||
|
@ -47,6 +50,18 @@ shadow_size = 10
|
|||
shadow_color = Color(0, 0, 0, 0.501961)
|
||||
shadow_offset = Vector2(5, 5)
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_5ly11"]
|
||||
shader = ExtResource("24_2se80")
|
||||
shader_parameter/line_opacity = 0.5
|
||||
shader_parameter/spacing = 2
|
||||
shader_parameter/scale = 1.0
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_0sjj2"]
|
||||
shader = ExtResource("20_u7jh7")
|
||||
shader_parameter/line_opacity = 0.25
|
||||
shader_parameter/spacing = 3
|
||||
shader_parameter/scale = 1.0
|
||||
|
||||
[sub_resource type="Animation" id="Animation_lyxis"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
|
@ -116,6 +131,10 @@ _data = {
|
|||
"fade_out_black": SubResource("Animation_b6gpx")
|
||||
}
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_b1hkp"]
|
||||
shader = ExtResource("19_5m168")
|
||||
shader_parameter/darken_screen = 0.0
|
||||
|
||||
[sub_resource type="Gradient" id="Gradient_3ox2i"]
|
||||
colors = PackedColorArray(0, 0, 0, 1, 0, 0, 0, 1)
|
||||
|
||||
|
@ -190,11 +209,11 @@ text = "PAUSED"
|
|||
label_settings = SubResource("LabelSettings_f2g0a")
|
||||
|
||||
[node name="TextboxUI" parent="." instance=ExtResource("12_8pgvx")]
|
||||
layer = 3
|
||||
layer = 6
|
||||
cps = 100.0
|
||||
|
||||
[node name="Fades" type="CanvasLayer" parent="."]
|
||||
layer = 2
|
||||
layer = 5
|
||||
|
||||
[node name="Control" type="Control" parent="Fades"]
|
||||
layout_mode = 3
|
||||
|
@ -205,6 +224,29 @@ grow_horizontal = 2
|
|||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
|
||||
[node name="ScanLines" type="ColorRect" parent="Fades/Control"]
|
||||
visible = false
|
||||
texture_filter = 1
|
||||
material = SubResource("ShaderMaterial_5ly11")
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="LCDDisplay" type="ColorRect" parent="Fades/Control"]
|
||||
texture_filter = 1
|
||||
material = SubResource("ShaderMaterial_0sjj2")
|
||||
layout_mode = 1
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
color = Color(0, 0, 0, 1)
|
||||
|
||||
[node name="NSFWReward" type="TextureRect" parent="Fades/Control"]
|
||||
visible = false
|
||||
layout_mode = 1
|
||||
|
@ -267,6 +309,19 @@ size_flags_horizontal = 0
|
|||
enabled = false
|
||||
initial_node_to_watch = NodePath("../../../ReedAI")
|
||||
|
||||
[node name="Postprocess" type="CanvasLayer" parent="."]
|
||||
layer = 128
|
||||
|
||||
[node name="Colors" type="ColorRect" parent="Postprocess"]
|
||||
visible = false
|
||||
texture_filter = 1
|
||||
material = SubResource("ShaderMaterial_b1hkp")
|
||||
anchors_preset = 15
|
||||
anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
|
||||
[node name="MapElements" type="Node2D" parent="."]
|
||||
y_sort_enabled = true
|
||||
position = Vector2(-136, -190)
|
||||
|
|
Loading…
Reference in a new issue