first commit
2
.gitattributes
vendored
Executable file
@@ -0,0 +1,2 @@
|
||||
# Normalize EOL for all files that Git considers text files.
|
||||
* text=auto eol=lf
|
||||
4
.gitignore
vendored
Executable file
@@ -0,0 +1,4 @@
|
||||
# Godot 4+ specific ignores
|
||||
.godot/
|
||||
old versions
|
||||
build
|
||||
93
CharacterBody3D.gd
Executable file
@@ -0,0 +1,93 @@
|
||||
extends CharacterBody3D
|
||||
|
||||
|
||||
const SPEED = 5.0
|
||||
|
||||
var camrot_x = 0.0
|
||||
var camrot_y = 0.0
|
||||
|
||||
var sensitivity = 0.25
|
||||
|
||||
|
||||
|
||||
var flickerWait = 0
|
||||
var flickerWaited = 0
|
||||
|
||||
|
||||
var gravity = ProjectSettings.get_setting("physics/3d/default_gravity")
|
||||
|
||||
func _ready():
|
||||
$emptyPlace.play()
|
||||
$catchingUp.play()
|
||||
Globals.makePlayerControlled()
|
||||
Globals.playerInitPos = position
|
||||
Globals.playerInitRotation = rotation
|
||||
camrot_x = $camera/UpDown.rotation_degrees.x
|
||||
camrot_y = rotation_degrees.y
|
||||
|
||||
func _process(delta):
|
||||
var x = (Globals.shrekPos.x-position.x)
|
||||
var z = (Globals.shrekPos.z-position.z)
|
||||
var distance = sqrt(x*x + z*z)
|
||||
if Globals.huntMode == -1 && distance > 100:
|
||||
Globals.huntMode = 0
|
||||
if Globals.huntMode == -1: distance = 1000
|
||||
$emptyPlace.volume_db = clamp(-65 + (distance - 40), -80, -65)
|
||||
$catchingUp.volume_db = clamp(-80*(distance/30), -80, 0)
|
||||
|
||||
$camera/UpDown/Camera3D.environment.fog_light_energy = clamp(((4-Globals.difficulty)/2)*((distance-10)/30), 0, (4-Globals.difficulty)/2)
|
||||
$camera/UpDown/Camera3D.environment.fog_density = 0.01 + (0.02*(Globals.difficulty/2))
|
||||
$camera/UpDown/torch/main.light_energy = clamp((3-(Globals.difficulty))*(distance/30), 0, (3-(Globals.difficulty)))
|
||||
$camera/UpDown/torch/outer.light_energy = clamp(0.1*(distance/30), 0, 0.1)
|
||||
$camera/UpDown/torch/main.spot_range = clamp(distance, 0, 40-(10*Globals.difficulty))
|
||||
$camera/UpDown/torch/main.light_color = Color(1.0,(185*clamp(distance/30, 0.0,1.0))/255,(122*clamp(distance/30, 0.0,1.0))/255,1)
|
||||
$camera/UpDown/torch/outer.light_color = $camera/UpDown/torch/main.light_color
|
||||
|
||||
if distance <= 30:
|
||||
flickerWaited += delta*1000
|
||||
if flickerWaited >= flickerWait:
|
||||
flickerWaited = 0
|
||||
$camera/UpDown.visible = !$camera/UpDown.visible
|
||||
flickerWait = randf_range(50, (75+((distance/30)*500)) if $camera/UpDown.visible else 75)
|
||||
else:
|
||||
$camera/UpDown.visible = true
|
||||
|
||||
func _input(event):
|
||||
if !Globals.playerControlled: return
|
||||
if event is InputEventMouseMotion:
|
||||
camrot_x -= float(event.relative.y)*sensitivity
|
||||
camrot_y -= float(event.relative.x)*sensitivity
|
||||
camrot_x = float(clamp(camrot_x, -70, 45))
|
||||
|
||||
|
||||
|
||||
func _physics_process(delta):
|
||||
# Add the gravity.
|
||||
if not is_on_floor():
|
||||
velocity.y -= gravity * delta
|
||||
|
||||
if Globals.playerControlled:
|
||||
var input_dir = Input.get_vector("move_left", "move_right", "move_forward", "move_back")
|
||||
var direction = (transform.basis * Vector3(input_dir.x, 0, input_dir.y)).normalized()
|
||||
if direction:
|
||||
velocity.x = direction.x * SPEED
|
||||
velocity.z = direction.z * SPEED
|
||||
else:
|
||||
velocity.x = move_toward(velocity.x, 0, SPEED)
|
||||
velocity.z = move_toward(velocity.z, 0, SPEED)
|
||||
|
||||
# Adjust the speed when moving backward
|
||||
if input_dir.y > 0:
|
||||
velocity.x *= 0.75
|
||||
velocity.z *= 0.75
|
||||
|
||||
$camera/UpDown.rotation_degrees.x = camrot_x
|
||||
|
||||
var look_dir = Input.get_vector("look_left", "look_right", "look_up", "look_down")
|
||||
var look_direction = Vector3(look_dir.x, 0, look_dir.y)
|
||||
camrot_x -= float(look_direction.z)*delta*sensitivity*1000
|
||||
camrot_y -= float(look_direction.x)*delta*sensitivity*1000
|
||||
camrot_x = float(clamp(camrot_x, -70, 45))
|
||||
rotation_degrees.y = camrot_y
|
||||
move_and_slide()
|
||||
Globals.playerPos = position
|
||||
1
CharacterBody3D.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://btyxythmyjil4
|
||||
12
GodotRetro/Object Shaders/Debug/helloworld-2d.shader
Executable file
@@ -0,0 +1,12 @@
|
||||
//SHADER GRABED FROM THE BOOK OF SHADERS
|
||||
//PORTED AND MODIFYED TO GODOT BY AHOPNESS (@ahopness)
|
||||
//LICENSE : CC0
|
||||
//SHADERTOY LINK : https://thebookofshaders.com/edit.php#03/space.frag
|
||||
|
||||
shader_type canvas_item;
|
||||
|
||||
void fragment(){
|
||||
vec2 st = UV;
|
||||
vec4 final = vec4(st.x, st.y, 0.0, 1.0);
|
||||
COLOR = final;
|
||||
}
|
||||
13
GodotRetro/Object Shaders/Debug/helloworld.shader
Executable file
@@ -0,0 +1,13 @@
|
||||
//SHADER GRABED FROM THE BOOK OF SHADERS
|
||||
//PORTED AND MODIFYED TO GODOT BY AHOPNESS (@ahopness)
|
||||
//LICENSE : CC0
|
||||
//SHADERTOY LINK : https://thebookofshaders.com/edit.php#03/space.frag
|
||||
|
||||
shader_type spatial;
|
||||
render_mode cull_disabled, specular_disabled, diffuse_lambert;
|
||||
|
||||
void fragment(){
|
||||
vec2 st = UV;
|
||||
vec3 final = vec3(st.x, st.y, 0.0);
|
||||
ALBEDO = final;
|
||||
}
|
||||
31
GodotRetro/Object Shaders/Debug/helloworld2-2d.shader
Executable file
@@ -0,0 +1,31 @@
|
||||
//SHADER GRABED FROM THE BOOK OF SHADERS
|
||||
//PORTED AND MODIFYED TO GODOT BY AHOPNESS (@ahopness)
|
||||
//LICENSE : CC0
|
||||
//SHADERTOY LINK : https://thebookofshaders.com/edit.php#06/hsb-colorwheel.frag
|
||||
|
||||
shader_type canvas_item;
|
||||
|
||||
const float TWO_PI = 6.28318530718;
|
||||
|
||||
vec3 hsb2rgb( in vec3 c ){
|
||||
vec3 rgb = clamp(abs(mod(c.x*6.0+vec3(0.0,4.0,2.0),
|
||||
6.0)-3.0)-1.0,
|
||||
0.0,
|
||||
1.0 );
|
||||
rgb = rgb*rgb*(3.0-2.0*rgb);
|
||||
return c.z * mix( vec3(1.0), rgb, c.y);
|
||||
}
|
||||
|
||||
void fragment(){
|
||||
vec2 st = UV;
|
||||
vec3 color = vec3(0.0);
|
||||
|
||||
// Use polar coordinates instead of cartesian
|
||||
vec2 toCenter = vec2(0.5)-st;
|
||||
float angle = atan(toCenter.y,toCenter.x);
|
||||
float radius = length(toCenter)*2.0;
|
||||
|
||||
// Map the angle (-PI to PI) to the Hue (from 0 to 1)
|
||||
// and the Saturation to the radius
|
||||
COLOR = vec4(hsb2rgb(vec3((angle/TWO_PI)+0.5,radius,1.0)), 1);
|
||||
}
|
||||
34
GodotRetro/Object Shaders/Debug/helloworld2.shader
Executable file
@@ -0,0 +1,34 @@
|
||||
//SHADER GRABED FROM THE BOOK OF SHADERS
|
||||
//PORTED AND MODIFYED TO GODOT BY AHOPNESS (@ahopness)
|
||||
//LICENSE : CC0
|
||||
//SHADERTOY LINK : https://thebookofshaders.com/edit.php#06/hsb-colorwheel.frag
|
||||
|
||||
shader_type spatial;
|
||||
render_mode cull_disabled, specular_disabled, diffuse_lambert, unshaded;
|
||||
|
||||
const float TWO_PI = 6.28318530718;
|
||||
|
||||
vec3 hsb2rgb( in vec3 c ){
|
||||
vec3 rgb = clamp(abs(mod(c.x*6.0+vec3(0.0,4.0,2.0),
|
||||
6.0)-3.0)-1.0,
|
||||
0.0,
|
||||
1.0 );
|
||||
rgb = rgb*rgb*(3.0-2.0*rgb);
|
||||
return c.z * mix( vec3(1.0), rgb, c.y);
|
||||
}
|
||||
|
||||
void fragment(){
|
||||
vec2 st = UV;
|
||||
vec3 color = vec3(0.0);
|
||||
|
||||
// Use polar coordinates instead of cartesian
|
||||
vec2 toCenter = vec2(0.5)-st;
|
||||
float angle = atan(toCenter.y,toCenter.x);
|
||||
float radius = length(toCenter)*2.0;
|
||||
|
||||
// Map the angle (-PI to PI) to the Hue (from 0 to 1)
|
||||
// and the Saturation to the radius
|
||||
color = hsb2rgb(vec3((angle/TWO_PI)+0.5,radius,1.0));
|
||||
|
||||
ALBEDO = color;
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
//SHADER ORIGINALY CREADED BY "marmitoTH" FROM GITHUB
|
||||
//
|
||||
//GITHUB LINK : https://github.com/marmitoTH/godot-psx-shaders
|
||||
|
||||
shader_type spatial;
|
||||
render_mode skip_vertex_transform, cull_disabled, diffuse_lambert_wrap, specular_phong, ambient_light_disabled;
|
||||
|
||||
uniform vec4 color : hint_color;
|
||||
uniform sampler2D albedoTex : hint_albedo;
|
||||
uniform float alpha_scissor_threshold;
|
||||
uniform float specular_intensity : hint_range(0, 1);
|
||||
uniform float resolution = 256;
|
||||
uniform float cull_distance = 5;
|
||||
uniform float affine_texture_mapping_amount : hint_range(0,2);
|
||||
uniform vec2 uv_scale = vec2(1.0, 1.0);
|
||||
uniform vec2 uv_offset = vec2(.0, .0);
|
||||
|
||||
varying vec4 vertex_coordinates;
|
||||
|
||||
void vertex() {
|
||||
UV = UV * uv_scale + uv_offset;
|
||||
|
||||
float vertex_distance = length((MODELVIEW_MATRIX * vec4(VERTEX, 1.0)));
|
||||
|
||||
VERTEX = (MODELVIEW_MATRIX * vec4(VERTEX, 1.0)).xyz;
|
||||
float vPos_w = (PROJECTION_MATRIX * vec4(VERTEX, 1.0)).w;
|
||||
VERTEX.xy = vPos_w * floor(resolution * VERTEX.xy / vPos_w) / resolution;
|
||||
vertex_coordinates = vec4(UV * VERTEX.z, VERTEX.z, .0);
|
||||
|
||||
if (vertex_distance > cull_distance)
|
||||
VERTEX = vec3(.0);
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
vec4 tex = texture(albedoTex, mix(vertex_coordinates.xy /vertex_coordinates.z, UV.xy, affine_texture_mapping_amount));
|
||||
|
||||
ALBEDO = tex.rgb * color.rgb;
|
||||
SPECULAR = specular_intensity;
|
||||
ALPHA = tex.a;
|
||||
ALPHA_SCISSOR = alpha_scissor_threshold;
|
||||
}
|
||||
55
GodotRetro/Object Shaders/PSX Shaders/Not Working/psx_lit_reflection.shader
Executable file
@@ -0,0 +1,55 @@
|
||||
//SHADER ORIGINALY CREADED BY "marmitoTH" FROM GITHUB
|
||||
//
|
||||
//GITHUB LINK : https://github.com/marmitoTH/godot-psx-shaders
|
||||
|
||||
shader_type spatial;
|
||||
render_mode skip_vertex_transform, diffuse_lambert_wrap, specular_phong, ambient_light_disabled;
|
||||
|
||||
uniform vec4 color : hint_color;
|
||||
uniform sampler2D albedoTex : hint_albedo;
|
||||
uniform samplerCube cubemap;
|
||||
uniform float reflection_intensity : hint_range(0, 1);
|
||||
uniform float specular_intensity : hint_range(0, 1);
|
||||
uniform float resolution = 256;
|
||||
uniform float cull_distance = 5;
|
||||
uniform float affine_texture_mapping_amount : hint_range(0,2);
|
||||
uniform vec2 uv_scale = vec2(1.0, 1.0);
|
||||
uniform vec2 uv_offset = vec2(.0, .0);
|
||||
|
||||
varying vec4 vertex_coordinates;
|
||||
varying vec3 reflection_coordinates;
|
||||
|
||||
void vertex() {
|
||||
UV = UV * uv_scale + uv_offset;
|
||||
|
||||
float vertex_distance = length((MODELVIEW_MATRIX * vec4(VERTEX, 1.0)));
|
||||
|
||||
VERTEX = (MODELVIEW_MATRIX * vec4(VERTEX, 1.0)).xyz;
|
||||
float vPos_w = (PROJECTION_MATRIX * vec4(VERTEX, 1.0)).w;
|
||||
VERTEX.xy = vPos_w * floor(resolution * VERTEX.xy / vPos_w) / resolution;
|
||||
vertex_coordinates = vec4(UV * VERTEX.z, VERTEX.z, .0);
|
||||
|
||||
if (vertex_distance > cull_distance)
|
||||
VERTEX = vec3(.0);
|
||||
|
||||
// Get camera position
|
||||
vec4 invcamx = INV_CAMERA_MATRIX[0];
|
||||
vec4 invcamy = INV_CAMERA_MATRIX[1];
|
||||
vec4 invcamz = INV_CAMERA_MATRIX[2];
|
||||
vec4 invcamw = INV_CAMERA_MATRIX[3];
|
||||
|
||||
vec3 camera_position = -invcamw.xyz * mat3(invcamx.xyz, invcamy.xyz, invcamz.xyz);
|
||||
|
||||
// Calculate reflections
|
||||
vec3 vertex_world = (CAMERA_MATRIX * vec4(VERTEX, 1.0)).xyz;
|
||||
reflection_coordinates = reflect(normalize(vertex_world - camera_position), normalize(WORLD_MATRIX * vec4(NORMAL, 0.0)).xyz);
|
||||
reflection_coordinates.z *= -1.0;
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
vec4 tex = texture(albedoTex, mix(vertex_coordinates.xy /vertex_coordinates.z, UV.xy, affine_texture_mapping_amount));
|
||||
vec4 cube = texture(cubemap, reflection_coordinates);
|
||||
|
||||
ALBEDO = mix(tex.rgb * color.rgb, cube.rgb, reflection_intensity);
|
||||
SPECULAR = specular_intensity;
|
||||
}
|
||||
38
GodotRetro/Object Shaders/PSX Shaders/psx_lit.shader
Executable file
@@ -0,0 +1,38 @@
|
||||
//SHADER ORIGINALY CREADED BY "marmitoTH" FROM GITHUB
|
||||
//
|
||||
//GITHUB LINK : https://github.com/marmitoTH/godot-psx-shaders
|
||||
|
||||
shader_type spatial;
|
||||
render_mode skip_vertex_transform, diffuse_lambert_wrap, specular_disabled, cull_disabled, depth_draw_alpha_prepass;
|
||||
|
||||
uniform vec4 color : hint_color;
|
||||
uniform sampler2D albedoTex : hint_albedo;
|
||||
uniform float specular_intensity : hint_range(0, 1);
|
||||
uniform float resolution = 256;
|
||||
uniform float cull_distance = 5;
|
||||
uniform float affine_texture_mapping_amount : hint_range(0,2);
|
||||
uniform vec2 uv_scale = vec2(1.0, 1.0);
|
||||
uniform vec2 uv_offset = vec2(.0, .0);
|
||||
|
||||
varying vec4 vertex_coordinates;
|
||||
|
||||
void vertex() {
|
||||
UV = UV * uv_scale + uv_offset;
|
||||
|
||||
float vertex_distance = length((MODELVIEW_MATRIX * vec4(VERTEX, 1.0)));
|
||||
|
||||
VERTEX = (MODELVIEW_MATRIX * vec4(VERTEX, 1.0)).xyz;
|
||||
float vPos_w = (PROJECTION_MATRIX * vec4(VERTEX, 1.0)).w;
|
||||
VERTEX.xy = vPos_w * floor(resolution * VERTEX.xy / vPos_w) / resolution;
|
||||
vertex_coordinates = vec4(UV * VERTEX.z, VERTEX.z, .0);
|
||||
|
||||
if (vertex_distance > cull_distance)
|
||||
VERTEX = vec3(.0);
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
vec4 tex = texture(albedoTex, mix(vertex_coordinates.xy /vertex_coordinates.z, UV.xy, affine_texture_mapping_amount));
|
||||
|
||||
ALBEDO = tex.rgb * color.rgb;
|
||||
SPECULAR = specular_intensity;
|
||||
}
|
||||
39
GodotRetro/Object Shaders/PSX Shaders/psx_unlit.shader
Executable file
@@ -0,0 +1,39 @@
|
||||
//SHADER ORIGINALY CREADED BY "marmitoTH" FROM GITHUB
|
||||
//
|
||||
//GITHUB LINK : https://github.com/marmitoTH/godot-psx-shaders
|
||||
|
||||
shader_type spatial;
|
||||
render_mode skip_vertex_transform, diffuse_lambert_wrap, specular_disabled, cull_disabled, unshaded, depth_draw_alpha_prepass;
|
||||
|
||||
uniform vec4 color : hint_color;
|
||||
uniform sampler2D albedoTex : hint_albedo;
|
||||
uniform float specular_intensity : hint_range(0, 1);
|
||||
uniform float resolution = 256;
|
||||
uniform float cull_distance = 5;
|
||||
uniform float affine_texture_mapping_amount : hint_range(0,2);
|
||||
uniform vec2 uv_scale = vec2(1.0, 1.0);
|
||||
uniform vec2 uv_offset = vec2(.0, .0);
|
||||
|
||||
varying vec4 vertex_coordinates;
|
||||
|
||||
void vertex() {
|
||||
UV = UV * uv_scale + uv_offset;
|
||||
|
||||
float vertex_distance = length((MODELVIEW_MATRIX * vec4(VERTEX, 1.0)));
|
||||
|
||||
VERTEX = (MODELVIEW_MATRIX * vec4(VERTEX, 1.0)).xyz;
|
||||
float vPos_w = (PROJECTION_MATRIX * vec4(VERTEX, 1.0)).w;
|
||||
VERTEX.xy = vPos_w * floor(resolution * VERTEX.xy / vPos_w) / resolution;
|
||||
vertex_coordinates = vec4(UV * VERTEX.z, VERTEX.z, .0);
|
||||
|
||||
if (vertex_distance > cull_distance)
|
||||
VERTEX = vec3(.0);
|
||||
}
|
||||
|
||||
void fragment() {
|
||||
vec4 tex = texture(albedoTex, mix(vertex_coordinates.xy /vertex_coordinates.z, UV.xy, affine_texture_mapping_amount));
|
||||
|
||||
ALBEDO = tex.rgb * color.rgb;
|
||||
ALPHA = tex.a * color.a;
|
||||
SPECULAR = specular_intensity;
|
||||
}
|
||||
BIN
GodotRetro/Other/Images/CRT Frame.png
Executable file
|
After Width: | Height: | Size: 17 KiB |
34
GodotRetro/Other/Images/CRT Frame.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://dp2l1wlxpc2ns"
|
||||
path="res://.godot/imported/CRT Frame.png-d90af3d39764073752b7b87b06bda556.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://GodotRetro/Other/Images/CRT Frame.png"
|
||||
dest_files=["res://.godot/imported/CRT Frame.png-d90af3d39764073752b7b87b06bda556.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
BIN
GodotRetro/Other/Images/bayer2x2.png
Executable file
|
After Width: | Height: | Size: 79 B |
34
GodotRetro/Other/Images/bayer2x2.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://beflcfa4v258i"
|
||||
path="res://.godot/imported/bayer2x2.png-f591b45d18ab4db92cfa8dd2fd75267f.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://GodotRetro/Other/Images/bayer2x2.png"
|
||||
dest_files=["res://.godot/imported/bayer2x2.png-f591b45d18ab4db92cfa8dd2fd75267f.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
BIN
GodotRetro/Other/Images/bayer8x8.png
Executable file
|
After Width: | Height: | Size: 308 B |
34
GodotRetro/Other/Images/bayer8x8.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://bulh812ihrgy1"
|
||||
path="res://.godot/imported/bayer8x8.png-b99b214d0a453da37b41f5b5b59598a0.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://GodotRetro/Other/Images/bayer8x8.png"
|
||||
dest_files=["res://.godot/imported/bayer8x8.png-b99b214d0a453da37b41f5b5b59598a0.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
BIN
GodotRetro/Other/Images/bluenoise128x128.png
Executable file
|
After Width: | Height: | Size: 16 KiB |
34
GodotRetro/Other/Images/bluenoise128x128.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://cnd8q6utgteqo"
|
||||
path="res://.godot/imported/bluenoise128x128.png-4f0eae80ab5c5f3a8c14d86f7924f7a5.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://GodotRetro/Other/Images/bluenoise128x128.png"
|
||||
dest_files=["res://.godot/imported/bluenoise128x128.png-4f0eae80ab5c5f3a8c14d86f7924f7a5.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
BIN
GodotRetro/Other/Images/grain.jpg
Executable file
|
After Width: | Height: | Size: 192 KiB |
34
GodotRetro/Other/Images/grain.jpg.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://kma5vyus4m7w"
|
||||
path="res://.godot/imported/grain.jpg-657f15066c3ccdf93bc92f8ff87ee7db.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://GodotRetro/Other/Images/grain.jpg"
|
||||
dest_files=["res://.godot/imported/grain.jpg-657f15066c3ccdf93bc92f8ff87ee7db.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
BIN
GodotRetro/Other/Images/psxdither.png
Executable file
|
After Width: | Height: | Size: 117 B |
34
GodotRetro/Other/Images/psxdither.png.import
Normal file
@@ -0,0 +1,34 @@
|
||||
[remap]
|
||||
|
||||
importer="texture"
|
||||
type="CompressedTexture2D"
|
||||
uid="uid://fnre1whl4uyq"
|
||||
path="res://.godot/imported/psxdither.png-156a195b1e8dd59b2f00fee407a98297.ctex"
|
||||
metadata={
|
||||
"vram_texture": false
|
||||
}
|
||||
|
||||
[deps]
|
||||
|
||||
source_file="res://GodotRetro/Other/Images/psxdither.png"
|
||||
dest_files=["res://.godot/imported/psxdither.png-156a195b1e8dd59b2f00fee407a98297.ctex"]
|
||||
|
||||
[params]
|
||||
|
||||
compress/mode=0
|
||||
compress/high_quality=false
|
||||
compress/lossy_quality=0.7
|
||||
compress/hdr_compression=1
|
||||
compress/normal_map=0
|
||||
compress/channel_pack=0
|
||||
mipmaps/generate=false
|
||||
mipmaps/limit=-1
|
||||
roughness/mode=0
|
||||
roughness/src_normal=""
|
||||
process/fix_alpha_border=true
|
||||
process/premult_alpha=false
|
||||
process/normal_map_invert_y=false
|
||||
process/hdr_as_srgb=false
|
||||
process/hdr_clamp_exposure=false
|
||||
process/size_limit=0
|
||||
detect_3d/compress_to=1
|
||||
276
GodotRetro/Screen Shaders/AccurateCRT.shader
Executable file
@@ -0,0 +1,276 @@
|
||||
//SHADER ORIGINALY CREADED BY "TimothyLottes" FROM SHADERTOY
|
||||
//MODIFIED AND PORTED TO GODOT BY AHOPNESS (@ahopness)
|
||||
//LICENSE : CC0
|
||||
//COMATIBLE WITH : GLES2, GLES3, WEBGL
|
||||
//SHADERTOY LINK : https://www.shadertoy.com/view/MsjXzh
|
||||
|
||||
// PUBLIC DOMAIN CRT STYLED SCAN-LINE SHADER
|
||||
//
|
||||
// by Timothy Lottes
|
||||
//
|
||||
// This is more along the style of a really good CGA arcade monitor.
|
||||
// With RGB inputs instead of NTSC.
|
||||
// The shadow mask example has the mask rotated 90 degrees for less chromatic aberration.
|
||||
//
|
||||
// Left it unoptimized to show the theory behind the algorithm.
|
||||
//
|
||||
// It is an example what I personally would want as a display option for pixel art games.
|
||||
// Please take and use, change, or whatever.
|
||||
|
||||
shader_type canvas_item;
|
||||
|
||||
// Emulated input resolution.
|
||||
uniform vec2 res;
|
||||
|
||||
// Mask type
|
||||
// 0 = Very compressed TV style shadow mask
|
||||
// 1 = Stretched VGA style shadow mask (same as prior shaders)
|
||||
// 2 = VGA style shadow mask
|
||||
uniform int mask_type :hint_range(0, 2) = 0;
|
||||
|
||||
// Bloom Type
|
||||
// 0 = Normalized exposure
|
||||
// 1 = Aditive bloom
|
||||
// 2 = No Bloom
|
||||
uniform int bloom_type :hint_range(0, 2) = 0;
|
||||
|
||||
// Hardness of scanline.
|
||||
// -8.0 = soft
|
||||
// -16.0 = medium
|
||||
uniform float hardScan :hint_range(-12.0, -1.0) = -8.0;
|
||||
|
||||
// Hardness of pixels in scanline.
|
||||
// -2.0 = soft
|
||||
// -4.0 = hard
|
||||
uniform float hardPix :hint_range(-4.0, 0.0) = -2.0;
|
||||
|
||||
// Hardness of short vertical bloom.
|
||||
// -1.0 = wide to the point of clipping (bad)
|
||||
// -1.5 = wide
|
||||
// -4.0 = not very wide at all
|
||||
uniform float hardBloomScan :hint_range(-4.0, 0.0) = -2.0;
|
||||
|
||||
// Hardness of short horizontal bloom.
|
||||
// -0.5 = wide to the point of clipping (bad)
|
||||
// -1.0 = wide
|
||||
// -2.0 = not very wide at all
|
||||
uniform float hardBloomPix :hint_range(-2.0, 0.0) = -1.5;
|
||||
|
||||
// Amount of small bloom effect.
|
||||
// 1.0/1.0 = only bloom
|
||||
// 1.0/16.0 = what I think is a good amount of small bloom
|
||||
// 0.0 = no bloom
|
||||
uniform float bloomAmount :hint_range(1.0, 16.0) = 16.0;
|
||||
|
||||
// Display warp.
|
||||
// 0.0 = none
|
||||
// 1.0/8.0 = extreme
|
||||
uniform vec2 warp = vec2(64.0, 24.0);
|
||||
|
||||
// Amount of shadow mask.
|
||||
uniform float maskDark :hint_range(0.0, 1.0) = 0.5;
|
||||
uniform float maskLight :hint_range(1.0, 2.0) = 1.5;
|
||||
|
||||
//------------------------------------------------------------------------
|
||||
|
||||
// sRGB to Linear.
|
||||
// Assuing using sRGB typed textures this should not be needed.
|
||||
float ToLinear1(float c){ return(c <= 0.04045) ? c / 12.92 : pow((c + 0.055) / 1.055, 2.4); }
|
||||
vec3 ToLinear(vec3 c){ return vec3(ToLinear1(c.r), ToLinear1(c.g), ToLinear1(c.b)); }
|
||||
|
||||
// Linear to sRGB.
|
||||
// Assuing using sRGB typed textures this should not be needed.
|
||||
float ToSrgb1(float c){ return(c < 0.0031308?c * 12.92 : 1.055 * pow(c, 0.41666) - 0.055); }
|
||||
vec3 ToSrgb(vec3 c){ return vec3(ToSrgb1(c.r), ToSrgb1(c.g), ToSrgb1(c.b)); }
|
||||
|
||||
// Nearest emulated sample given floating point position and texel offset.
|
||||
// Also zero's off screen.
|
||||
vec3 Fetch(vec2 pos, vec2 off, sampler2D iChannel0){
|
||||
pos = floor(pos * res + off) / res;
|
||||
|
||||
if(max(abs(pos.x - 0.5), abs(pos.y - 0.5)) > 0.5){
|
||||
return vec3(0.0, 0.0, 0.0);
|
||||
}
|
||||
|
||||
return ToLinear(texture(iChannel0 , pos.xy , -16.0).rgb);
|
||||
}
|
||||
|
||||
// Distance in emulated pixels to nearest texel.
|
||||
vec2 Dist(vec2 pos){
|
||||
pos = pos * res;
|
||||
return - ((pos - floor(pos)) - vec2(0.5));
|
||||
}
|
||||
|
||||
// 1D Gaussian.
|
||||
float Gaus(float pos, float scale){ return exp2(scale * pos * pos); }
|
||||
|
||||
// 3-tap Gaussian filter along horz line.
|
||||
vec3 Horz3(vec2 pos, float off, sampler2D iChannel0){
|
||||
vec3 b = Fetch(pos, vec2(-1.0, off), iChannel0);
|
||||
vec3 c = Fetch(pos, vec2( 0.0, off), iChannel0);
|
||||
vec3 d = Fetch(pos, vec2( 1.0, off), iChannel0);
|
||||
float dst = Dist(pos).x;
|
||||
|
||||
// Convert distance to weight.
|
||||
float scale = hardPix;
|
||||
float wb = Gaus(dst - 1.0, scale);
|
||||
float wc = Gaus(dst + 0.0, scale);
|
||||
float wd = Gaus(dst + 1.0, scale);
|
||||
|
||||
// Return filtered sample.
|
||||
return (b * wb + c * wc + d * wd) / (wb + wc + wd);
|
||||
}
|
||||
// 5-tap Gaussian filter along horz line.
|
||||
vec3 Horz5(vec2 pos, float off, sampler2D iChannel0){
|
||||
vec3 a = Fetch(pos, vec2(-2.0, off), iChannel0);
|
||||
vec3 b = Fetch(pos, vec2(-1.0, off), iChannel0);
|
||||
vec3 c = Fetch(pos, vec2( 0.0, off), iChannel0);
|
||||
vec3 d = Fetch(pos, vec2( 1.0, off), iChannel0);
|
||||
vec3 e = Fetch(pos, vec2( 2.0, off), iChannel0);
|
||||
float dst = Dist(pos).x;
|
||||
|
||||
// Convert distance to weight.
|
||||
float scale = hardPix;
|
||||
float wa = Gaus(dst - 2.0, scale);
|
||||
float wb = Gaus(dst - 1.0, scale);
|
||||
float wc = Gaus(dst + 0.0, scale);
|
||||
float wd = Gaus(dst + 1.0, scale);
|
||||
float we = Gaus(dst + 2.0, scale);
|
||||
|
||||
// Return filtered sample.
|
||||
return (a * wa + b * wb + c * wc + d * wd + e * we) / (wa + wb + wc + wd + we);
|
||||
}
|
||||
// 7-tap Gaussian filter along horz line.
|
||||
vec3 Horz7(vec2 pos, float off, sampler2D iChannel0){
|
||||
vec3 a = Fetch(pos, vec2(-3.0, off), iChannel0);
|
||||
vec3 b = Fetch(pos, vec2(-2.0, off), iChannel0);
|
||||
vec3 c = Fetch(pos, vec2( 1.0, off), iChannel0);
|
||||
vec3 d = Fetch(pos, vec2( 0.0, off), iChannel0);
|
||||
vec3 e = Fetch(pos, vec2( 1.0, off), iChannel0);
|
||||
vec3 f = Fetch(pos, vec2( 2.0, off), iChannel0);
|
||||
vec3 g = Fetch(pos, vec2( 3.0, off), iChannel0);
|
||||
float dst = Dist(pos).x;
|
||||
|
||||
// Convert distance to weight.
|
||||
float scale = hardBloomPix;
|
||||
float wa = Gaus(dst - 3.0, scale);
|
||||
float wb = Gaus(dst - 2.0, scale);
|
||||
float wc = Gaus(dst - 1.0, scale);
|
||||
float wd = Gaus(dst + 0.0, scale);
|
||||
float we = Gaus(dst + 1.0, scale);
|
||||
float wf = Gaus(dst + 2.0, scale);
|
||||
float wg = Gaus(dst + 3.0, scale);
|
||||
|
||||
// Return filtered sample.
|
||||
return (a * wa + b * wb + c * wc + d * wd + e * we + f * wf + g * wg) / (wa + wb + wc + wd + we + wf + wg);
|
||||
}
|
||||
|
||||
// Return scanline weight.
|
||||
float Scan(vec2 pos, float off){
|
||||
float dst = Dist(pos).y;
|
||||
|
||||
return Gaus(dst + off, hardScan);
|
||||
}
|
||||
|
||||
// Return scanline weight for bloom.
|
||||
float BloomScan(vec2 pos, float off){
|
||||
float dst = Dist(pos).y;
|
||||
|
||||
return Gaus(dst + off, hardBloomScan);
|
||||
}
|
||||
|
||||
// Allow nearest three lines to effect pixel.
|
||||
vec3 Tri(vec2 pos, sampler2D iChannel0){
|
||||
vec3 a = Horz3(pos,-1.0, iChannel0);
|
||||
vec3 b = Horz5(pos, 0.0, iChannel0);
|
||||
vec3 c = Horz3(pos, 1.0, iChannel0);
|
||||
|
||||
float wa = Scan(pos,-1.0);
|
||||
float wb = Scan(pos, 0.0);
|
||||
float wc = Scan(pos, 1.0);
|
||||
|
||||
return a * wa + b * wb + c * wc;
|
||||
}
|
||||
|
||||
// Small bloom.
|
||||
vec3 Bloom(vec2 pos, sampler2D iChannel0){
|
||||
vec3 a = Horz5(pos,-2.0, iChannel0);
|
||||
vec3 b = Horz7(pos,-1.0, iChannel0);
|
||||
vec3 c = Horz7(pos, 0.0, iChannel0);
|
||||
vec3 d = Horz7(pos, 1.0, iChannel0);
|
||||
vec3 e = Horz5(pos, 2.0, iChannel0);
|
||||
|
||||
float wa = BloomScan(pos,-2.0);
|
||||
float wb = BloomScan(pos,-1.0);
|
||||
float wc = BloomScan(pos, 0.0);
|
||||
float wd = BloomScan(pos, 1.0);
|
||||
float we = BloomScan(pos, 2.0);
|
||||
|
||||
return a * wa + b * wb + c * wc + d * wd + e * we;
|
||||
}
|
||||
|
||||
// Distortion of scanlines, and end of screen alpha.
|
||||
vec2 Warp(vec2 pos){
|
||||
pos = pos * 2.0 - 1.0;
|
||||
pos *= vec2(1.0 + (pos.y * pos.y) * 1.0 / warp.x, 1.0 + (pos.x * pos.x) * 1.0/ warp.y);
|
||||
|
||||
return pos * 0.5+0.5;
|
||||
}
|
||||
|
||||
vec3 Mask(vec2 pos){
|
||||
if (mask_type == 0){
|
||||
float line = maskLight;
|
||||
float odd = 0.0;
|
||||
|
||||
if(fract(pos.x / 6.0) < 0.5) odd = 1.0;
|
||||
if(fract((pos.y + odd) / 2.0) < 0.5) line = maskDark;
|
||||
pos.x = fract(pos.x / 3.0);
|
||||
|
||||
vec3 mask = vec3(maskDark, maskDark, maskDark);
|
||||
if(pos.x < 0.333)mask.r = maskLight;
|
||||
else if(pos.x < 0.666)mask.g = maskLight;
|
||||
else mask.b = maskLight;
|
||||
|
||||
mask *= line;
|
||||
return mask;
|
||||
}else if (mask_type == 1){
|
||||
pos.x += pos.y * 3.0;
|
||||
|
||||
vec3 mask = vec3(maskDark, maskDark, maskDark);
|
||||
pos.x = fract(pos.x / 6.0);
|
||||
if(pos.x < 0.333)mask.r = maskLight;
|
||||
else if(pos.x < 0.666)mask.g = maskLight;
|
||||
else mask.b = maskLight;
|
||||
|
||||
return mask;
|
||||
}else if (mask_type == 2){
|
||||
pos.xy = floor(pos.xy * vec2(1.0, 0.5));
|
||||
pos.x += pos.y * 3.0;
|
||||
|
||||
vec3 mask = vec3(maskDark, maskDark, maskDark);
|
||||
pos.x = fract(pos.x / 6.0);
|
||||
if(pos.x < 0.333)mask.r = maskLight;
|
||||
else if(pos.x < 0.666)mask.g = maskLight;
|
||||
else mask.b = maskLight;
|
||||
|
||||
return mask;
|
||||
}
|
||||
}
|
||||
|
||||
// Draw dividing bars.
|
||||
float Bar(float pos, float bar){ pos -= bar; return pos * pos < 4.0 ? 0.0 : 1.0; }
|
||||
|
||||
// Entry.
|
||||
void fragment(){
|
||||
vec2 pos = Warp(FRAGCOORD.xy / (1.0 / SCREEN_PIXEL_SIZE).xy);
|
||||
|
||||
COLOR.rgb = Tri(pos, SCREEN_TEXTURE) * Mask(FRAGCOORD.xy);
|
||||
if (bloom_type == 0){
|
||||
COLOR.rgb = mix(COLOR.rgb,Bloom(pos, SCREEN_TEXTURE), 1.0 / bloomAmount);
|
||||
}else if (bloom_type == 1){
|
||||
COLOR.rgb += Bloom(pos, SCREEN_TEXTURE) * 1.0 / bloomAmount;
|
||||
}
|
||||
|
||||
COLOR.a = 1.0;
|
||||
COLOR.rgb = ToSrgb(COLOR.rgb);
|
||||
}
|
||||
29
GodotRetro/Screen Shaders/Aditional Shaders/B&W.shader
Executable file
@@ -0,0 +1,29 @@
|
||||
//SHADER ORIGINALY CREADED BY "demofox" FROM SHADERTOY
|
||||
//MODIFIED AND PORTED TO GODOT BY AHOPNESS (@ahopness)
|
||||
//LICENSE : CC0
|
||||
//COMATIBLE WITH : GLES2, GLES3, WEBGL
|
||||
//SHADERTOY LINK : https://www.shadertoy.com/view/XdXSzX
|
||||
|
||||
shader_type canvas_item;
|
||||
|
||||
uniform float contrast :hint_range(0.0, 3.0) = 1.0;
|
||||
uniform float brightness :hint_range(-1.0, 1.0) = 0.0;
|
||||
|
||||
|
||||
void fragment(){
|
||||
vec2 uv = FRAGCOORD.xy / (1.0 / SCREEN_PIXEL_SIZE).xy;
|
||||
|
||||
vec3 pixelColor = texture(SCREEN_TEXTURE, uv).xyz;
|
||||
|
||||
// Grayscale
|
||||
float pixelGrey = dot(pixelColor, vec3(0.2126, 0.7152, 0.0722));
|
||||
pixelColor = vec3(pixelGrey);
|
||||
|
||||
// Contrast
|
||||
pixelColor.rgb = ((pixelColor.rgb - 0.5) * max(contrast, 0.0)) + 0.5;
|
||||
|
||||
// Brightness
|
||||
pixelColor.rgb += brightness;
|
||||
|
||||
COLOR = vec4(pixelColor, 1.0);
|
||||
}
|
||||
40
GodotRetro/Screen Shaders/Aditional Shaders/BetterCC.shader
Executable file
@@ -0,0 +1,40 @@
|
||||
//SHADER ORIGINALY CREADED BY "Wunkolo" FROM SHADERTOY
|
||||
//MODIFIED AND PORTED TO GODOT BY AHOPNESS (@ahopness)
|
||||
//LICENSE : CC0
|
||||
//COMATIBLE WITH : GLES2, GLES3, WEBGL
|
||||
//SHADERTOY LINK : https://www.shadertoy.com/view/tllfRf
|
||||
|
||||
shader_type canvas_item;
|
||||
|
||||
uniform vec4 Shadows :hint_color = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
uniform vec4 Midtones :hint_color = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
uniform vec4 Hilights :hint_color = vec4(0.0, 0.0, 0.0, 1.0);
|
||||
|
||||
vec3 InvLerp( vec3 A, vec3 B, vec3 t){
|
||||
return (t - A) / (B - A);
|
||||
}
|
||||
|
||||
vec3 ColorGrade( in vec3 InColor ){
|
||||
// Calculate the three offseted colors up-front
|
||||
vec3 OffShadows = InColor + Shadows.xyz;
|
||||
vec3 OffMidtones = InColor + Midtones.xyz;
|
||||
vec3 OffHilights = InColor + Hilights.xyz;
|
||||
|
||||
// Linearly interpolate between the 3 new colors, piece-wise
|
||||
return mix(
|
||||
// We pick which of the two control points to interpolate from based on which side of
|
||||
// 0.5 the input color channel lands on
|
||||
mix(OffShadows, OffMidtones, InvLerp(vec3(0.0), vec3(0.5), InColor)), // < 0.5
|
||||
mix(OffMidtones, OffHilights, InvLerp(vec3(0.5), vec3(1.0), InColor)), // >= 0.5
|
||||
greaterThanEqual(InColor, vec3(0.5))
|
||||
);
|
||||
}
|
||||
|
||||
void fragment(){
|
||||
vec2 uv = FRAGCOORD.xy / vec2(1.0 / SCREEN_PIXEL_SIZE.xy);
|
||||
COLOR.a = 1.0;
|
||||
COLOR.rgb = texture(SCREEN_TEXTURE, uv).rgb;
|
||||
COLOR.rgb = ColorGrade(COLOR.rgb);
|
||||
|
||||
//COLOR.rgb = pow(COLOR.rgb, vec3(2.2));
|
||||
}
|
||||
62
GodotRetro/Screen Shaders/Aditional Shaders/Blur.shader
Executable file
@@ -0,0 +1,62 @@
|
||||
//SHADER ORIGINALY CREADED BY "jcant0n" FROM SHADERTOY
|
||||
//MODIFIED AND PORTED TO GODOT BY AHOPNESS (@ahopness)
|
||||
//LICENSE : CC0
|
||||
//COMATIBLE WITH : GLES2, GLES3, WEBGL
|
||||
//SHADERTOY LINK : https://www.shadertoy.com/view/XssSDs#
|
||||
|
||||
shader_type canvas_item;
|
||||
|
||||
uniform float amount :hint_range(0.0, 1.5) = 1.0;
|
||||
|
||||
vec2 Circle(float Start, float Points, float Point) {
|
||||
float Rad = (3.141592 * 3.0 * (1.0 / Points)) * (Point + Start);
|
||||
return vec2(sin(Rad), cos(Rad));
|
||||
}
|
||||
|
||||
void fragment(){
|
||||
vec2 uv = FRAGCOORD.xy / (1.0 / SCREEN_PIXEL_SIZE).xy;
|
||||
vec2 PixelOffset = amount / (1.0 / SCREEN_PIXEL_SIZE).xy;
|
||||
|
||||
float Start = 2.0 / 14.0;
|
||||
vec2 Scale = 0.66 * 4.0 * 2.0 * PixelOffset.xy;
|
||||
|
||||
vec3 N0 = texture(SCREEN_TEXTURE, uv + Circle(Start, 14.0, 0.0) * Scale).rgb;
|
||||
vec3 N1 = texture(SCREEN_TEXTURE, uv + Circle(Start, 14.0, 1.0) * Scale).rgb;
|
||||
vec3 N2 = texture(SCREEN_TEXTURE, uv + Circle(Start, 14.0, 2.0) * Scale).rgb;
|
||||
vec3 N3 = texture(SCREEN_TEXTURE, uv + Circle(Start, 14.0, 3.0) * Scale).rgb;
|
||||
vec3 N4 = texture(SCREEN_TEXTURE, uv + Circle(Start, 14.0, 4.0) * Scale).rgb;
|
||||
vec3 N5 = texture(SCREEN_TEXTURE, uv + Circle(Start, 14.0, 5.0) * Scale).rgb;
|
||||
vec3 N6 = texture(SCREEN_TEXTURE, uv + Circle(Start, 14.0, 6.0) * Scale).rgb;
|
||||
vec3 N7 = texture(SCREEN_TEXTURE, uv + Circle(Start, 14.0, 7.0) * Scale).rgb;
|
||||
vec3 N8 = texture(SCREEN_TEXTURE, uv + Circle(Start, 14.0, 8.0) * Scale).rgb;
|
||||
vec3 N9 = texture(SCREEN_TEXTURE, uv + Circle(Start, 14.0, 9.0) * Scale).rgb;
|
||||
vec3 N10 = texture(SCREEN_TEXTURE, uv + Circle(Start, 14.0, 10.0) * Scale).rgb;
|
||||
vec3 N11 = texture(SCREEN_TEXTURE, uv + Circle(Start, 14.0, 11.0) * Scale).rgb;
|
||||
vec3 N12 = texture(SCREEN_TEXTURE, uv + Circle(Start, 14.0, 12.0) * Scale).rgb;
|
||||
vec3 N13 = texture(SCREEN_TEXTURE, uv + Circle(Start, 14.0, 13.0) * Scale).rgb;
|
||||
vec3 N14 = texture(SCREEN_TEXTURE, uv).rgb;
|
||||
|
||||
float W = 1.0 / 15.0;
|
||||
|
||||
vec3 color = vec3(0,0,0);
|
||||
|
||||
color.rgb =
|
||||
(N0 * W) +
|
||||
(N1 * W) +
|
||||
(N2 * W) +
|
||||
(N3 * W) +
|
||||
(N4 * W) +
|
||||
(N5 * W) +
|
||||
(N6 * W) +
|
||||
(N7 * W) +
|
||||
(N8 * W) +
|
||||
(N9 * W) +
|
||||
(N10 * W) +
|
||||
(N11 * W) +
|
||||
(N12 * W) +
|
||||
(N13 * W) +
|
||||
(N14 * W);
|
||||
|
||||
COLOR = vec4(color.rgb,1.0);
|
||||
}
|
||||
|
||||
30
GodotRetro/Screen Shaders/Aditional Shaders/ColorPrecission.shader
Executable file
@@ -0,0 +1,30 @@
|
||||
//SHADER ORIGINALY CREADED BY "abelcamarena" FROM SHADERTOY
|
||||
//MODIFIED AND PORTED TO GODOT BY AHOPNESS (@ahopness)
|
||||
//LICENSE : CC0
|
||||
//COMATIBLE WITH : GLES2, GLES3, WEBGL
|
||||
//SHADERTOY LINK : https://www.shadertoy.com/view/tsKGDm
|
||||
|
||||
// Looking for ditheirng? I reccomend using this shader instead :
|
||||
// https://github.com/WittyCognomen/godot-psx-shaders/blob/master/shaders/psx_dither_post.shader
|
||||
// https://github.com/WittyCognomen/godot-psx-shaders/tree/master/shaders/dithers
|
||||
|
||||
shader_type canvas_item;
|
||||
|
||||
uniform float SCREEN_WIDTH = 320.; // Lower num - bigger pixels (this will be the screen width)
|
||||
uniform float COLOR_FACTOR :hint_range(0., 10.) = 4.; // Higher num - higher colors quality
|
||||
|
||||
void fragment(){
|
||||
// Reduce pixels
|
||||
vec2 size = SCREEN_WIDTH * SCREEN_PIXEL_SIZE.xy/SCREEN_PIXEL_SIZE.x;
|
||||
vec2 coor = floor( UV * size) ;
|
||||
vec2 uv = FRAGCOORD.xy / (1.0 / SCREEN_PIXEL_SIZE).xy;
|
||||
|
||||
// Get source color
|
||||
vec3 col = texture(SCREEN_TEXTURE, uv).xyz;
|
||||
|
||||
// Reduce colors
|
||||
col = floor(col * COLOR_FACTOR) / COLOR_FACTOR;
|
||||
|
||||
// Output to screen
|
||||
COLOR = vec4(col,1.);
|
||||
}
|
||||
44
GodotRetro/Screen Shaders/Aditional Shaders/Dithering.shader
Executable file
@@ -0,0 +1,44 @@
|
||||
//SHADER ORIGINALY CREADED BY "abelcamarena" FROM SHADERTOY
|
||||
//MODIFIED AND PORTED TO GODOT BY AHOPNESS (@ahopness)
|
||||
//LICENSE : CC0
|
||||
//COMATIBLE WITH : GLES2, GLES3, WEBGL
|
||||
//SHADERTOY LINK : https://www.shadertoy.com/view/tsKGDm
|
||||
|
||||
shader_type canvas_item;
|
||||
|
||||
uniform float SCREEN_WIDTH = 320.; // Lower num - bigger pixels (this will be the screen width)
|
||||
uniform float COLOR_FACTOR :hint_range(0., 10.) = 4.; // Higher num - higher colors quality
|
||||
uniform float DITHERING_STRENTH :hint_range(0., .07) = 0.005; // Be carefull with this one, dithering can get messy really easily
|
||||
|
||||
int PSXDither(ivec2 fragcoord) {
|
||||
const int dither_table[16] = {
|
||||
-4, +0, -3, +1,
|
||||
+2, -2, +3, -1,
|
||||
-3, +1, -4, +0,
|
||||
+3, -1, +2, -2
|
||||
};
|
||||
|
||||
int x = fragcoord.x % 4;
|
||||
int y = fragcoord.y % 4;
|
||||
|
||||
return dither_table[y * 4 + x];
|
||||
}
|
||||
|
||||
void fragment(){
|
||||
// Reduce pixels
|
||||
vec2 size = SCREEN_WIDTH * SCREEN_PIXEL_SIZE.xy/SCREEN_PIXEL_SIZE.x;
|
||||
vec2 coor = floor( UV * size) ;
|
||||
vec2 uv = FRAGCOORD.xy / (1.0 / SCREEN_PIXEL_SIZE).xy;
|
||||
|
||||
// Get source color
|
||||
vec3 col = texture(SCREEN_TEXTURE, uv).xyz;
|
||||
|
||||
// Dithering
|
||||
col += float(PSXDither(ivec2(FRAGCOORD.xy))) * DITHERING_STRENTH;
|
||||
|
||||
// Reduce colors
|
||||
col = floor(col * COLOR_FACTOR) / COLOR_FACTOR;
|
||||
|
||||
// Output to screen
|
||||
COLOR = vec4(col,1.);
|
||||
}
|
||||
27
GodotRetro/Screen Shaders/Aditional Shaders/Sharpness.shader
Executable file
@@ -0,0 +1,27 @@
|
||||
//SHADER ORIGINALY CREADED BY "Nihilistic_Furry" FROM SHADERTOY
|
||||
//MODIFIED AND PORTED TO GODOT BY AHOPNESS (@ahopness)
|
||||
//LICENSE : CC0
|
||||
//COMATIBLE WITH : GLES2, GLES3, WEBGL
|
||||
//SHADERTOY LINK : https://www.shadertoy.com/view/wsK3Wt
|
||||
|
||||
shader_type canvas_item;
|
||||
|
||||
uniform float sharpen_amount :hint_range(0,4) = 1.0;
|
||||
|
||||
vec4 sharpenMask (sampler2D st, vec2 fc, vec2 sps){
|
||||
// Sharpen detection matrix [0,1,0],[1,-4,1],[0,1,0]
|
||||
// Colors
|
||||
vec4 up = texture (st, (fc + vec2 (0, 1))/sps);
|
||||
vec4 left = texture (st, (fc + vec2 (-1, 0))/sps);
|
||||
vec4 center = texture (st, fc/sps);
|
||||
vec4 right = texture (st, (fc + vec2 (1, 0))/sps);
|
||||
vec4 down = texture (st, (fc + vec2 (0, -1))/sps);
|
||||
|
||||
// Return edge detection
|
||||
return (1.0 + 4.0*sharpen_amount)*center -sharpen_amount*(up + left + right + down);
|
||||
}
|
||||
|
||||
void fragment(){
|
||||
// Detect edges and output to screen
|
||||
COLOR = sharpenMask (SCREEN_TEXTURE, FRAGCOORD.xy, 1.0 / SCREEN_PIXEL_SIZE);
|
||||
}
|
||||
53
GodotRetro/Screen Shaders/Glitch.shader
Executable file
@@ -0,0 +1,53 @@
|
||||
//SHADER ORIGINALY CREADED BY "keijiro" FROM GITHUB
|
||||
//MODIFIED AND PORTED TO GODOT BY AHOPNESS (@ahopness)
|
||||
//LICENSE : https://github.com/keijiro/KinoGlitch#license
|
||||
//COMATIBLE WITH : GLES2, GLES3, WEBGL
|
||||
//GITHUB LINK : https://github.com/keijiro/KinoGlitch
|
||||
|
||||
shader_type canvas_item;
|
||||
|
||||
uniform float _ScanLineJitter : hint_range(.2, 1) = .25; // (displacement, threshold)
|
||||
uniform float _VerticalJump : hint_range(0, 1) = .01; // (amount, time)
|
||||
uniform float _HorizontalShake : hint_range(0, 1) = 0;
|
||||
uniform float _ColorDrift : hint_range(0, 1) = .02; // (amount, time)
|
||||
|
||||
|
||||
float nrand(float x, float y){
|
||||
return fract(sin(dot(vec2(x, y), vec2(12.9898, 78.233))) * 43758.5453);
|
||||
}
|
||||
|
||||
void fragment(){
|
||||
float sl_thresh = dot(vec2(1.0 - _ScanLineJitter * 1.2), vec2(1.0 - _ScanLineJitter * 1.2));
|
||||
float sl_disp = 0.002 + pow(_ScanLineJitter, 3) * 0.05;
|
||||
vec2 sl = vec2(sl_disp, sl_thresh);
|
||||
|
||||
float _verticalJumpTime = TIME * _VerticalJump * 11.3;
|
||||
vec2 vj = vec2(_VerticalJump, _verticalJumpTime);
|
||||
|
||||
float hs = _HorizontalShake * 0.2;
|
||||
|
||||
vec2 cd = vec2(_ColorDrift * 0.04f, TIME * 606.11f);
|
||||
|
||||
float u = FRAGCOORD.x / (1.0 / SCREEN_PIXEL_SIZE).x;
|
||||
float v = FRAGCOORD.y / (1.0 / SCREEN_PIXEL_SIZE).y;
|
||||
|
||||
// Scan line jitter
|
||||
float jitter = nrand(v, TIME) * 2.0 - 1.0;
|
||||
jitter *= step(sl.y, abs(jitter)) * sl.x;
|
||||
|
||||
// Vertical jump
|
||||
float jump = mix(v, fract(v + vj.y), vj.x);
|
||||
|
||||
// Horizontal shake
|
||||
float shake = (nrand(TIME, 2) - 0.5) * hs;
|
||||
|
||||
// Color drift
|
||||
float drift = sin(jump + cd.y) * cd.x;
|
||||
|
||||
vec4 final1 = texture(SCREEN_TEXTURE, fract(vec2(u + jitter + shake, jump)));
|
||||
vec4 final2 = texture(SCREEN_TEXTURE, fract(vec2(u + jitter + shake + drift, jump)));
|
||||
|
||||
vec4 render = vec4(final1.r, final2.g, final1.b, 1);
|
||||
|
||||
COLOR = render;
|
||||
}
|
||||
125
GodotRetro/Screen Shaders/Grain.shader
Executable file
@@ -0,0 +1,125 @@
|
||||
//SHADER ORIGINALY CREADED BY "spl!te" FROM GITHUB FOR GODOT 2.1
|
||||
//MODIFIED AND PORTED TO GODOT BY AHOPNESS (@ahopness)
|
||||
//LICENSE : CC0
|
||||
//COMATIBLE WITH : GLES2, GLES3
|
||||
//GITHUB LINK : https://github.com/splite/Godot_Film_Grain_Shader
|
||||
//ORIGINAL POST LINK : http://devlog-martinsh.blogspot.com/2013/05/image-imperfections-and-film-grain-post.html
|
||||
|
||||
shader_type canvas_item;
|
||||
|
||||
uniform bool colored = false; //colored noise?
|
||||
uniform float color_amount :hint_range(0, 1.3) = 0.6;
|
||||
uniform float grain_amount :hint_range(0, 0.07) = 0.025; //grain amount
|
||||
uniform float grain_size :hint_range(1, 3) = 1.6; //grain particle size (1.5 - 2.5)
|
||||
uniform float lum_amount :hint_range(0, 2) = 1.3;
|
||||
|
||||
varying float time;
|
||||
|
||||
void vertex(){
|
||||
time = TIME;
|
||||
}
|
||||
|
||||
//a random texture generator, but you can also use a pre-computed perturbation texture
|
||||
vec4 rnm(vec2 tc) {
|
||||
float noise = sin(dot(tc + vec2(time,time),vec2(12.9898,78.233))) * 43758.5453;
|
||||
float noiseR = fract(noise)*2.0-1.0;
|
||||
float noiseG = fract(noise*1.2154)*2.0-1.0;
|
||||
float noiseB = fract(noise*1.3453)*2.0-1.0;
|
||||
float noiseA = fract(noise*1.3647)*2.0-1.0;
|
||||
return vec4(noiseR,noiseG,noiseB,noiseA);
|
||||
}
|
||||
|
||||
float fade(float t) {
|
||||
return t*t*t*(t*(t*6.0-15.0)+10.0);
|
||||
}
|
||||
|
||||
float pnoise3D(vec3 p){
|
||||
vec3 pi = 0.00390625*floor(p);
|
||||
pi = vec3(pi.x+0.001953125, pi.y+0.001953125, pi.z+0.001953125);
|
||||
vec3 pf = fract(p); // Fractional part for interpolation
|
||||
|
||||
// Noise contributions from (x=0, y=0), z=0 and z=1
|
||||
float perm00 = rnm(pi.xy).a ;
|
||||
vec3 grad000 = rnm(vec2(perm00, pi.z)).rgb * 4.0;
|
||||
grad000 = vec3(grad000.x - 1.0, grad000.y - 1.0, grad000.z - 1.0);
|
||||
float n000 = dot(grad000, pf);
|
||||
vec3 grad001 = rnm(vec2(perm00, pi.z + 0.00390625)).rgb * 4.0;
|
||||
grad001 = vec3(grad001.x - 1.0, grad001.y - 1.0, grad001.z - 1.0);
|
||||
float n001 = dot(grad001, pf - vec3(0.0, 0.0, 1.0));
|
||||
|
||||
// Noise contributions from (x=0, y=1), z=0 and z=1
|
||||
float perm01 = rnm(pi.xy + vec2(0.0, 0.00390625)).a ;
|
||||
vec3 grad010 = rnm(vec2(perm01, pi.z)).rgb * 4.0;
|
||||
grad010 = vec3(grad010.x - 1.0, grad010.y - 1.0, grad010.z - 1.0);
|
||||
float n010 = dot(grad010, pf - vec3(0.0, 1.0, 0.0));
|
||||
vec3 grad011 = rnm(vec2(perm01, pi.z + 0.00390625)).rgb * 4.0;
|
||||
grad011 = vec3(grad011.x - 1.0, grad011.y - 1.0, grad011.z - 1.0);
|
||||
float n011 = dot(grad011, pf - vec3(0.0, 1.0, 1.0));
|
||||
|
||||
// Noise contributions from (x=1, y=0), z=0 and z=1
|
||||
float perm10 = rnm(pi.xy + vec2(0.00390625, 0.0)).a ;
|
||||
vec3 grad100 = rnm(vec2(perm10, pi.z)).rgb * 4.0;
|
||||
grad100 = vec3(grad100.x - 1.0, grad100.y - 1.0, grad100.z - 1.0);
|
||||
float n100 = dot(grad100, pf - vec3(1.0, 0.0, 0.0));
|
||||
vec3 grad101 = rnm(vec2(perm10, pi.z + 0.00390625)).rgb * 4.0;
|
||||
grad101 = vec3(grad101.x - 1.0, grad101.y - 1.0, grad101.z - 1.0);
|
||||
float n101 = dot(grad101, pf - vec3(1.0, 0.0, 1.0));
|
||||
|
||||
// Noise contributions from (x=1, y=1), z=0 and z=1
|
||||
float perm11 = rnm(pi.xy + vec2(0.00390625, 0.00390625)).a ;
|
||||
vec3 grad110 = rnm(vec2(perm11, pi.z)).rgb * 4.0;
|
||||
grad110 = vec3(grad110.x - 1.0, grad110.y - 1.0, grad110.z - 1.0);
|
||||
float n110 = dot(grad110, pf - vec3(1.0, 1.0, 0.0));
|
||||
vec3 grad111 = rnm(vec2(perm11, pi.z + 0.00390625)).rgb * 4.0;
|
||||
grad111 = vec3(grad111.x - 1.0, grad111.y - 1.0, grad111.z - 1.0);
|
||||
float n111 = dot(grad111, pf - vec3(1.0, 1.0, 1.0));
|
||||
|
||||
// Blend contributions along x
|
||||
vec4 n_x = mix(vec4(n000, n001, n010, n011), vec4(n100, n101, n110, n111), fade(pf.x));
|
||||
|
||||
// Blend contributions along y
|
||||
vec2 n_xy = mix(n_x.xy, n_x.zw, fade(pf.y));
|
||||
|
||||
// Blend contributions along z
|
||||
float n_xyz = mix(n_xy.x, n_xy.y, fade(pf.z));
|
||||
|
||||
// We're done, return the final noise value.
|
||||
return n_xyz;
|
||||
}
|
||||
|
||||
//2d coordinate orientation thing
|
||||
vec2 coordRot(vec2 tc, float angle, vec2 screen_size){
|
||||
float aspect = screen_size.x/screen_size.y;
|
||||
float rotX = ((tc.x*2.0-1.0)*aspect*cos(angle)) - ((tc.y*2.0-1.0)*sin(angle));
|
||||
float rotY = ((tc.y*2.0-1.0)*cos(angle)) + ((tc.x*2.0-1.0)*aspect*sin(angle));
|
||||
rotX = ((rotX/aspect)*0.5+0.5);
|
||||
rotY = rotY*0.5+0.5;
|
||||
return vec2(rotX,rotY);
|
||||
}
|
||||
|
||||
void fragment (){
|
||||
vec2 screen_size = (1.0 / SCREEN_PIXEL_SIZE).xy;
|
||||
vec3 rotOffset = vec3(1.425,3.892,5.835); //rotation offset values
|
||||
vec2 rotCoordsR = coordRot(UV, time + rotOffset.x, screen_size);
|
||||
vec3 noise = vec3(pnoise3D(vec3(rotCoordsR*vec2(screen_size.x/grain_size,screen_size.y/grain_size),0.0)));
|
||||
|
||||
if (colored){
|
||||
vec2 rotCoordsG = coordRot(UV, time + rotOffset.y, screen_size);
|
||||
vec2 rotCoordsB = coordRot(UV, time + rotOffset.z, screen_size);
|
||||
noise.g = mix(noise.r,pnoise3D(vec3(rotCoordsG*vec2(screen_size.x/grain_size,screen_size.y/grain_size),1.0)),color_amount);
|
||||
noise.b = mix(noise.r,pnoise3D(vec3(rotCoordsB*vec2(screen_size.x/grain_size,screen_size.y/grain_size),2.0)),color_amount);
|
||||
}
|
||||
|
||||
vec3 col = texture(TEXTURE, UV).rgb;
|
||||
vec3 lumcoeff = vec3(0.299,0.587,0.114);
|
||||
float luminance = mix(0.0,dot(col, lumcoeff),lum_amount);
|
||||
float lum = smoothstep(0.2,0.0,luminance);
|
||||
lum += luminance;
|
||||
|
||||
noise = mix(noise,vec3(0.0),pow(lum,4.0));
|
||||
col = col+noise*grain_amount;
|
||||
|
||||
vec4 SRC_COLOR = texture(SCREEN_TEXTURE, SCREEN_UV);
|
||||
|
||||
COLOR = vec4(col,1.0) * SRC_COLOR;
|
||||
}
|
||||
40
GodotRetro/Screen Shaders/JpegCompression.shader
Executable file
@@ -0,0 +1,40 @@
|
||||
//SHADER ORIGINALY CREADED BY "paniq" FROM SHADERTOY
|
||||
//MODIFIED AND PORTED TO GODOT BY AHOPNESS (@ahopness)
|
||||
//LICENSE : CC0
|
||||
//COMATIBLE WITH : GLES2, GLES3, WEBGL
|
||||
//SHADERTOY LINK : https://www.shadertoy.com/view/MdcGzj
|
||||
|
||||
shader_type canvas_item;
|
||||
|
||||
uniform float color_depth :hint_range(0.0, 255.0) = 100.0;
|
||||
uniform float color_number :hint_range(0.0, 50.0) = 20.0;
|
||||
|
||||
const mat3 rgb2ycbcr = mat3(
|
||||
vec3(0.299, -0.168736, 0.5),
|
||||
vec3(0.587, -0.331264, -0.418688),
|
||||
vec3(0.114, 0.5, -0.081312)
|
||||
);
|
||||
const mat3 ycbcr2rgb = mat3(
|
||||
vec3(1.0, 1.0, 1.0),
|
||||
vec3(0.0, -0.344136, 1.772),
|
||||
vec3(1.402, -0.714136, 0.0)
|
||||
);
|
||||
|
||||
// simulating 8:4:4 compression ratio (16bit)
|
||||
vec3 compress_ycbcr_844 (vec3 rgb) {
|
||||
vec3 ycbcr = rgb2ycbcr * rgb;
|
||||
ycbcr.r = floor(ycbcr.r * color_depth + 0.5) / color_depth;
|
||||
ycbcr.gb += 0.5;
|
||||
ycbcr.gb = floor(ycbcr.gb * color_number + 0.5) / color_number;
|
||||
ycbcr.gb -= 0.5;
|
||||
return ycbcr2rgb * ycbcr;
|
||||
}
|
||||
|
||||
|
||||
void fragment(){
|
||||
vec2 uv = FRAGCOORD.xy / (1.0 / SCREEN_PIXEL_SIZE).xy;
|
||||
vec3 rgb = texture(SCREEN_TEXTURE, uv).rgb;
|
||||
rgb = compress_ycbcr_844(rgb);
|
||||
|
||||
COLOR = vec4(rgb,1.0);
|
||||
}
|
||||
29
GodotRetro/Screen Shaders/LensDistortion.shader
Executable file
@@ -0,0 +1,29 @@
|
||||
//SHADER ORIGINALY CREADED BY "jcant0n" FROM SHADERTOY
|
||||
//MODIFIED AND PORTED TO GODOT BY AHOPNESS (@ahopness)
|
||||
//LICENSE : CC0
|
||||
//COMATIBLE WITH : GLES2, GLES3, WEBGL
|
||||
//SHADERTOY LINK : https://www.shadertoy.com/view/4sSSzz
|
||||
|
||||
shader_type canvas_item;
|
||||
|
||||
uniform float strength :hint_range(-0.035, 0.035) = 0.0;
|
||||
|
||||
void fragment(){
|
||||
vec2 Resolution = 1.0 / SCREEN_PIXEL_SIZE;
|
||||
vec2 uv = FRAGCOORD.xy / Resolution.xy;
|
||||
float aspectRatio = Resolution.x / Resolution.y;
|
||||
|
||||
|
||||
vec2 intensity = vec2(strength * aspectRatio);
|
||||
|
||||
vec2 coords = uv;
|
||||
coords = (coords - 0.5) * 2.0;
|
||||
|
||||
vec2 realCoordOffs;
|
||||
realCoordOffs.x = (1.0 - coords.y * coords.y) * intensity.y * (coords.x);
|
||||
realCoordOffs.y = (1.0 - coords.x * coords.x) * intensity.x * (coords.y);
|
||||
|
||||
vec4 color = texture(SCREEN_TEXTURE, uv - realCoordOffs);
|
||||
|
||||
COLOR = vec4(color);
|
||||
}
|
||||
120
GodotRetro/Screen Shaders/NTSC.shader
Executable file
@@ -0,0 +1,120 @@
|
||||
//SHADER ORIGINALY CREADED BY "ompuco" FROM SHADERTOY
|
||||
//MODIFIED AND PORTED TO GODOT BY AHOPNESS (@ahopness)
|
||||
//LICENSE : CC0
|
||||
//COMATIBLE WITH : GLES2, GLES3, WEBGL
|
||||
//SHADERTOY LINK : https://www.shadertoy.com/view/XlsczN
|
||||
|
||||
shader_type canvas_item;
|
||||
|
||||
uniform float blur_amount :hint_range(0.0, 8.0) = 3.0;
|
||||
uniform float signal_quality :hint_range(0.0, 0.5) = 0;
|
||||
uniform float bottom_strenth :hint_range(0.0, 6.0) = 3.0;
|
||||
uniform sampler2D grain_tex;
|
||||
|
||||
float grain (vec2 st, float iTime) {
|
||||
return fract(sin(dot(st.xy, vec2(17.0,180.)))* 2500. + iTime);
|
||||
}
|
||||
|
||||
vec3 rgb2yiq(vec3 c){
|
||||
return vec3(
|
||||
(0.2989 * c.x + 0.5959 * c.y + 0.2115 * c.z),
|
||||
(0.5870 * c.x - 0.2744 * c.y - 0.5229 * c.z),
|
||||
(0.1140 * c.x - 0.3216 * c.y + 0.3114 * c.z)
|
||||
);
|
||||
}
|
||||
vec3 yiq2rgb(vec3 c){
|
||||
return vec3(
|
||||
(1.0 * c.x + 1.0 * c.y + 1.0 * c.z),
|
||||
(0.956 * c.x - 0.2720 * c.y - 1.1060 * c.z),
|
||||
(0.6210 * c.x - 0.6474 * c.y + 1.7046 * c.z)
|
||||
);
|
||||
}
|
||||
|
||||
vec2 Circle(float Start, float Points, float Point){
|
||||
float Rad = (3.141592 * 2.0 * (1.0 / Points)) * (Point + Start);
|
||||
return vec2(-(.3+Rad), cos(Rad));
|
||||
}
|
||||
|
||||
vec3 Blur(vec2 uv, float f, float d, float iTime, sampler2D iChannel0){
|
||||
float t = (sin(iTime * 5.0 + uv.y * 5.0)) / 10.0;
|
||||
float b = 1.0;
|
||||
|
||||
t = 0.0;
|
||||
vec2 PixelOffset = vec2(d + .0005 * t, 0);
|
||||
|
||||
float Start = 2.0 / 14.0;
|
||||
vec2 Scale = 0.66 * blur_amount * 2.0 * PixelOffset.xy;
|
||||
|
||||
vec3 N0 = texture(iChannel0, uv + Circle(Start, 14.0, 0.0) * Scale).rgb;
|
||||
vec3 N1 = texture(iChannel0, uv + Circle(Start, 14.0, 1.0) * Scale).rgb;
|
||||
vec3 N2 = texture(iChannel0, uv + Circle(Start, 14.0, 2.0) * Scale).rgb;
|
||||
vec3 N3 = texture(iChannel0, uv + Circle(Start, 14.0, 3.0) * Scale).rgb;
|
||||
vec3 N4 = texture(iChannel0, uv + Circle(Start, 14.0, 4.0) * Scale).rgb;
|
||||
vec3 N5 = texture(iChannel0, uv + Circle(Start, 14.0, 5.0) * Scale).rgb;
|
||||
vec3 N6 = texture(iChannel0, uv + Circle(Start, 14.0, 6.0) * Scale).rgb;
|
||||
vec3 N7 = texture(iChannel0, uv + Circle(Start, 14.0, 7.0) * Scale).rgb;
|
||||
vec3 N8 = texture(iChannel0, uv + Circle(Start, 14.0, 8.0) * Scale).rgb;
|
||||
vec3 N9 = texture(iChannel0, uv + Circle(Start, 14.0, 9.0) * Scale).rgb;
|
||||
vec3 N10 = texture(iChannel0, uv + Circle(Start, 14.0, 10.0) * Scale).rgb;
|
||||
vec3 N11 = texture(iChannel0, uv + Circle(Start, 14.0, 11.0) * Scale).rgb;
|
||||
vec3 N12 = texture(iChannel0, uv + Circle(Start, 14.0, 12.0) * Scale).rgb;
|
||||
vec3 N13 = texture(iChannel0, uv + Circle(Start, 14.0, 13.0) * Scale).rgb;
|
||||
vec3 N14 = texture(iChannel0, uv).rgb;
|
||||
|
||||
vec4 clr = texture(iChannel0, uv);
|
||||
float W = 1.0 / 15.0;
|
||||
|
||||
clr.rgb=
|
||||
(N0 * W) +
|
||||
(N1 * W) +
|
||||
(N2 * W) +
|
||||
(N3 * W) +
|
||||
(N4 * W) +
|
||||
(N5 * W) +
|
||||
(N6 * W) +
|
||||
(N7 * W) +
|
||||
(N8 * W) +
|
||||
(N9 * W) +
|
||||
(N10 * W) +
|
||||
(N11 * W) +
|
||||
(N12 * W) +
|
||||
(N13 * W) +
|
||||
(N14 * W);
|
||||
|
||||
return vec3(clr.xyz)*b;
|
||||
}
|
||||
|
||||
void fragment(){
|
||||
float d = 0.1 * 1.0 / 50.0;
|
||||
vec2 uv = FRAGCOORD.xy / (1.0 / SCREEN_PIXEL_SIZE).xy;
|
||||
|
||||
float s = signal_quality * grain(vec2(uv.x, uv.y * 777777777777777.0), TIME); // Sorry...
|
||||
// Main tearing
|
||||
float e = min(0.30, pow(max(0.0, cos(uv.y * 4.0 + 0.3) - 0.75) * (s + 0.5) * 1.0, 3.0)) * 25.0;
|
||||
s -= pow(texture(SCREEN_TEXTURE, vec2(0.01 + (uv.y * 32.0) / 32.0, 1.0)).r, 1.0);
|
||||
uv.x += e * abs(s * 3.0);
|
||||
// Bootom tearing
|
||||
float r = texture(grain_tex, vec2(mod(TIME * 10.0, mod(TIME * 10.0, 256.0) * (1.0 / 256.0)), 0.0)).r * (2.0 * s);
|
||||
uv.x += abs(r * pow(min(0.003, (uv.y - 0.15)) * bottom_strenth, 2.0));
|
||||
|
||||
// Apply blur
|
||||
d = 0.051 + abs(sin(s / 4.0));
|
||||
float c = max(0.0001, 0.002 * d);
|
||||
|
||||
COLOR.xyz = Blur(uv, 0.0, c + c * (uv.x), TIME, SCREEN_TEXTURE);
|
||||
float y = rgb2yiq(COLOR.xyz).r;
|
||||
|
||||
uv.x += 0.01 * d;
|
||||
c *= 6.0;
|
||||
COLOR.xyz = Blur(uv, 0.333 ,c, TIME, SCREEN_TEXTURE);
|
||||
float i = rgb2yiq(COLOR.xyz).g;
|
||||
|
||||
uv.x += 0.005 * d;
|
||||
|
||||
c *= 2.50;
|
||||
COLOR.xyz = Blur(uv, 0.666, c, TIME, SCREEN_TEXTURE);
|
||||
float q = rgb2yiq(COLOR.xyz).b;
|
||||
|
||||
COLOR.xyz = yiq2rgb(vec3(y, i, q)) - pow(s + e * 2.0, 3.0);
|
||||
COLOR.xyz *= smoothstep(1.0, 0.999, uv.x - .1);
|
||||
}
|
||||
79
GodotRetro/Screen Shaders/NTSCBasic.shader
Executable file
@@ -0,0 +1,79 @@
|
||||
//SHADER ORIGINALY CREADED BY "keijiro" FROM GITHUB
|
||||
//MODIFIED AND PORTED TO GODOT BY AHOPNESS (@ahopness)
|
||||
//LICENSE : MIT
|
||||
//COMATIBLE WITH : GLES2, GLES3
|
||||
//GITHUB LINK : https://github.com/keijiro/KinoTube/
|
||||
|
||||
shader_type canvas_item;
|
||||
|
||||
const float PI = 3.14159265359;
|
||||
|
||||
uniform float _bleeding :hint_range(0, 1) = 0.5;
|
||||
uniform float _fringing :hint_range(0, 1) = 0.5;
|
||||
uniform float _scanline :hint_range(0, 1) = 0.5;
|
||||
uniform bool linearColorSpace = true;
|
||||
|
||||
vec3 LinearToGammaSpace (vec3 linRGB){
|
||||
linRGB = max(linRGB, vec3(0, 0, 0));
|
||||
return max(1.055 * pow(linRGB, vec3(0.416666667)) - 0.055, 0);
|
||||
}
|
||||
vec3 GammaToLinearSpace (vec3 sRGB){
|
||||
return sRGB * (sRGB * (sRGB * 0.305306011 + 0.682171111) + 0.012522878);
|
||||
}
|
||||
|
||||
vec3 RGB2YIQ(vec3 rgb){
|
||||
rgb = clamp(rgb, 0, 1);
|
||||
if (!linearColorSpace){
|
||||
rgb = LinearToGammaSpace(rgb);
|
||||
}
|
||||
return mat3(vec3(0.299, 0.587, 0.114),
|
||||
vec3(0.596, -0.274, -0.322),
|
||||
vec3(0.211, -0.523, 0.313)) * rgb;
|
||||
}
|
||||
vec3 YIQ2RGB(vec3 yiq){
|
||||
vec3 rgb = mat3(vec3(1, 0.956, 0.621),
|
||||
vec3(1, -0.272, -0.647),
|
||||
vec3(1, -1.106, 1.703)) * yiq;
|
||||
|
||||
rgb = clamp(rgb, 0, 1);
|
||||
if (!linearColorSpace){
|
||||
rgb = GammaToLinearSpace(rgb);
|
||||
}
|
||||
|
||||
return rgb;
|
||||
}
|
||||
|
||||
vec3 SampleYIQ(vec2 uv, float du, sampler2D _MainTex){
|
||||
uv.x += du;
|
||||
return RGB2YIQ(texture(_MainTex, uv).rgb);
|
||||
}
|
||||
|
||||
void fragment(){
|
||||
float bleedWidth = 0.04 * _bleeding; // width of bleeding
|
||||
float bleedStep = 2.5 / (1.0 / SCREEN_PIXEL_SIZE).x; // max interval of taps
|
||||
float bleedTaps = ceil(bleedWidth / bleedStep);
|
||||
float bleedDelta = bleedWidth / bleedTaps;
|
||||
float fringeWidth = 0.0025 * _fringing; // width of fringing
|
||||
|
||||
vec2 uv = FRAGCOORD.xy / (1.0 / SCREEN_PIXEL_SIZE).xy;
|
||||
vec3 yiq = SampleYIQ(uv, 0, SCREEN_TEXTURE);
|
||||
|
||||
// Bleeding
|
||||
for (float i = 0.0; i < bleedTaps; i++)
|
||||
{
|
||||
yiq.y += SampleYIQ(uv, - bleedTaps * i, SCREEN_TEXTURE).y;
|
||||
yiq.z += SampleYIQ(uv, + bleedTaps * i, SCREEN_TEXTURE).z;
|
||||
}
|
||||
yiq.yz /= bleedTaps + 1.0;
|
||||
|
||||
// Fringing
|
||||
float y1 = SampleYIQ(uv, - fringeWidth, SCREEN_TEXTURE).x;
|
||||
float y2 = SampleYIQ(uv, + fringeWidth, SCREEN_TEXTURE).x;
|
||||
yiq.yz += y2 - y1;
|
||||
|
||||
// Scanline
|
||||
float scan = sin(uv.y * 500.0 * PI);
|
||||
scan = mix(1.0, (scan + 1.0) / 2.0, _scanline);
|
||||
|
||||
COLOR = vec4(YIQ2RGB(yiq * scan), 1);
|
||||
}
|
||||
53
GodotRetro/Screen Shaders/SimpleGlitch.shader
Executable file
@@ -0,0 +1,53 @@
|
||||
//SHADER ORIGINALY CREADED BY "Gaktan" FROM SHADERTOY
|
||||
//MODIFIED AND PORTED TO GODOT BY AHOPNESS (@ahopness)
|
||||
//LICENSE : CC0
|
||||
//COMATIBLE WITH : GLES2, GLES3
|
||||
//SHADERTOY LINK : https://www.shadertoy.com/view/Ms3XWH#
|
||||
|
||||
shader_type canvas_item;
|
||||
|
||||
uniform float range = 0.03;
|
||||
uniform float noiseQuality :hint_range(0,250) = 250.0;
|
||||
uniform float noiseIntensity :hint_range(0, 0.05) = 0.005;
|
||||
uniform float offsetIntensity = 0.01;
|
||||
uniform float colorOffsetIntensity :hint_range(0,1.5) = 0.3;
|
||||
|
||||
float rand(vec2 co){
|
||||
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
|
||||
}
|
||||
|
||||
float verticalBar(float pos, float uvY, float offset){
|
||||
float edge0 = (pos - range);
|
||||
float edge1 = (pos + range);
|
||||
|
||||
float x = smoothstep(edge0, pos, uvY) * offset;
|
||||
x -= smoothstep(pos, edge1, uvY) * offset;
|
||||
return x;
|
||||
}
|
||||
|
||||
void fragment(){
|
||||
vec2 uv = FRAGCOORD.xy / (1.0 / SCREEN_PIXEL_SIZE).xy;
|
||||
|
||||
for (float i = 0.0; i < 0.71; i += 0.1313){
|
||||
float d = mod(TIME - tan(TIME * 0.24 * i), 0);
|
||||
float o = sin(1.0 - tan(TIME * 0.24 * i));
|
||||
o *= offsetIntensity;
|
||||
uv.x += verticalBar(d, uv.y, o);
|
||||
}
|
||||
|
||||
float uvY = uv.y;
|
||||
uvY *= noiseQuality;
|
||||
uvY = float(int(uvY)) * (1.0 / noiseQuality);
|
||||
float noise = rand(vec2(TIME * 0.00001, uvY));
|
||||
uv.x += noise * noiseIntensity;
|
||||
|
||||
vec2 offsetR = vec2(0.006 * sin(TIME), 0.0) * colorOffsetIntensity;
|
||||
vec2 offsetG = vec2(0.0073 * (cos(TIME * 0.97)), 0.0) * colorOffsetIntensity;
|
||||
|
||||
float r = texture(SCREEN_TEXTURE, uv + offsetR).r;
|
||||
float g = texture(SCREEN_TEXTURE, uv + offsetG).g;
|
||||
float b = texture(SCREEN_TEXTURE, uv).b;
|
||||
|
||||
vec4 tex = vec4(r, g, b, 1.0);
|
||||
COLOR = tex;
|
||||
}
|
||||
30
GodotRetro/Screen Shaders/SimpleGrain.shader
Executable file
@@ -0,0 +1,30 @@
|
||||
//SHADER ORIGINALY CREADED BY "juniorxsound" FROM SHADERTOY
|
||||
//MODIFIED AND PORTED TO GODOT BY AHOPNESS (@ahopness)
|
||||
//LICENSE : CC0
|
||||
//COMATIBLE WITH : GLES2, GLES3, WEBGL
|
||||
//SHADERTOY LINK : https://www.shadertoy.com/view/ldScWw
|
||||
|
||||
shader_type canvas_item;
|
||||
|
||||
uniform float amount :hint_range(0.0, 0.4) = 0.1;
|
||||
|
||||
float grain (vec2 st, float time){
|
||||
return fract(sin(dot(st.xy, vec2(17.0,180.)))* 2500. + time);
|
||||
}
|
||||
|
||||
void fragment(){
|
||||
//Coords
|
||||
vec2 uv = FRAGCOORD.xy / (1.0 / SCREEN_PIXEL_SIZE).xy;
|
||||
|
||||
//Produce some noise based on the coords
|
||||
vec3 grainPlate = vec3(grain(uv, TIME));
|
||||
|
||||
//Get the image
|
||||
vec4 img = texture(SCREEN_TEXTURE, uv);
|
||||
|
||||
//Mix the two signals together
|
||||
vec3 mixer = mix(img.rgb, grainPlate, amount);
|
||||
|
||||
|
||||
COLOR = vec4(mixer,1.0);
|
||||
}
|
||||
124
GodotRetro/Screen Shaders/TV.shader
Executable file
@@ -0,0 +1,124 @@
|
||||
//SHADER ORIGINALY CREADED BY "ehj1" FROM SHADERTOY
|
||||
//MODIFIED AND PORTED TO GODOT BY AHOPNESS (@ahopness)
|
||||
//LICENSE : CC0
|
||||
//COMATIBLE WITH : GLES2, GLES3
|
||||
//SHADERTOY LINK : https://www.shadertoy.com/view/ldXGW4
|
||||
|
||||
shader_type canvas_item;
|
||||
|
||||
uniform float vertJerkOpt :hint_range(0,1) = 0.2;
|
||||
uniform float vertMovementOpt :hint_range(0,1) = 0.0;
|
||||
uniform float bottomStaticOpt :hint_range(0,5) = 0.0;
|
||||
uniform float bottomStaticStrenth :hint_range(0.0, 1.5) = 0.7;
|
||||
uniform float scalinesOpt :hint_range(0,6) = 0.8;
|
||||
uniform float rgbOffsetOpt :hint_range(0,2) = 0.2;
|
||||
uniform float horzFuzzOpt :hint_range(0,5) = 0.15;
|
||||
|
||||
// Noise generation functions borrowed from:
|
||||
// https://github.com/ashima/webgl-noise/blob/master/src/noise2D.glsl
|
||||
|
||||
vec3 mod289vec3(vec3 x){
|
||||
return x - floor(x * (1.0 / 289.0)) * 289.0;
|
||||
}
|
||||
|
||||
vec2 mod289vec2(vec2 x){
|
||||
return x - floor(x * (1.0 / 289.0)) * 289.0;
|
||||
}
|
||||
|
||||
vec3 permute(vec3 x){
|
||||
return mod289vec3(((x*34.0)+1.0)*x);
|
||||
}
|
||||
|
||||
float snoise(vec2 v){
|
||||
const vec4 C = vec4(0.211324865405187, // (3.0-sqrt(3.0))/6.0
|
||||
0.366025403784439, // 0.5*(sqrt(3.0)-1.0)
|
||||
-0.577350269189626, // -1.0 + 2.0 * C.x
|
||||
0.024390243902439); // 1.0 / 41.0
|
||||
// First corner
|
||||
vec2 i = floor(v + dot(v, C.yy) );
|
||||
vec2 x0 = v - i + dot(i, C.xx);
|
||||
|
||||
// Other corners
|
||||
vec2 i1;
|
||||
//i1.x = step( x0.y, x0.x ); // x0.x > x0.y ? 1.0 : 0.0
|
||||
//i1.y = 1.0 - i1.x;
|
||||
i1 = (x0.x > x0.y) ? vec2(1.0, 0.0) : vec2(0.0, 1.0);
|
||||
// x0 = x0 - 0.0 + 0.0 * C.xx ;
|
||||
// x1 = x0 - i1 + 1.0 * C.xx ;
|
||||
// x2 = x0 - 1.0 + 2.0 * C.xx ;
|
||||
vec4 x12 = x0.xyxy + C.xxzz;
|
||||
x12.xy -= i1;
|
||||
|
||||
// Permutations
|
||||
i = mod289vec2(i); // Avoid truncation effects in permutation
|
||||
vec3 p = permute( permute( i.y + vec3(0.0, i1.y, 1.0 ))
|
||||
+ i.x + vec3(0.0, i1.x, 1.0 ));
|
||||
|
||||
vec3 m = max(0.5 - vec3(dot(x0,x0), dot(x12.xy,x12.xy), dot(x12.zw,x12.zw)), 0.0);
|
||||
m = m*m ;
|
||||
m = m*m ;
|
||||
|
||||
// Gradients: 41 points uniformly over a line, mapped onto a diamond.
|
||||
// The ring size 17*17 = 289 is close to a multiple of 41 (41*7 = 287)
|
||||
|
||||
vec3 x = 2.0 * fract(p * C.www) - 1.0;
|
||||
vec3 h = abs(x) - 0.5;
|
||||
vec3 ox = floor(x + 0.5);
|
||||
vec3 a0 = x - ox;
|
||||
|
||||
// Normalise gradients implicitly by scaling m
|
||||
// Approximation of: m *= inversesqrt( a0*a0 + h*h );
|
||||
m *= 1.79284291400159 - 0.85373472095314 * ( a0*a0 + h*h );
|
||||
|
||||
// Compute final noise value at P
|
||||
vec3 g;
|
||||
g.x = a0.x * x0.x + h.x * x0.y;
|
||||
g.yz = a0.yz * x12.xz + h.yz * x12.yw;
|
||||
return 130.0 * dot(m, g);
|
||||
}
|
||||
|
||||
float staticV(vec2 uv, float time){
|
||||
float staticHeight = snoise(vec2(9.0,float(time)*1.2+3.0))*bottomStaticStrenth+5.0;
|
||||
float staticAmount = snoise(vec2(1.0,time*1.2-6.0))*0.1+0.3;
|
||||
float staticStrength = snoise(vec2(-9.75,time*0.6-3.0))*2.0+2.0;
|
||||
return (1.0-step(snoise(vec2(5.0*pow(time,2.0)+pow(uv.x*7.0,1.2),pow((mod(time,100.0)+100.0)*uv.y*0.3+3.0,staticHeight))),staticAmount))*staticStrength;
|
||||
}
|
||||
|
||||
|
||||
void fragment(){
|
||||
vec2 uv = FRAGCOORD.xy / (1.0 / SCREEN_PIXEL_SIZE).xy;
|
||||
|
||||
float jerkOffset = (1.0-step(snoise(vec2(TIME*1.3,5.0)),0.8))*0.05;
|
||||
|
||||
float fuzzOffset = snoise(vec2(TIME*15.0,uv.y*80.0))*0.003;
|
||||
float largeFuzzOffset = snoise(vec2(TIME*1.0,uv.y*25.0))*0.004;
|
||||
|
||||
float vertMovementOn = (1.0-step(snoise(vec2(TIME*0.2,8.0)),0.4))*vertMovementOpt;
|
||||
float vertJerk = (1.0-step(snoise(vec2(TIME*1.5,5.0)),0.6))*vertJerkOpt;
|
||||
float vertJerk2 = (1.0-step(snoise(vec2(TIME*5.5,5.0)),0.2))*vertJerkOpt;
|
||||
float yOffset = abs(sin(TIME)*4.0)*vertMovementOn+vertJerk*vertJerk2*0.3;
|
||||
float _y = mod(uv.y+yOffset,1.0);
|
||||
|
||||
|
||||
float xOffset = (fuzzOffset + largeFuzzOffset) * horzFuzzOpt;
|
||||
|
||||
float staticVal = 0.0;
|
||||
|
||||
for (float y = -1.0; y <= 1.0; y += 1.0) {
|
||||
float maxDist = 5.0/200.0;
|
||||
float dist = y/200.0;
|
||||
staticVal += staticV(vec2(uv.x,uv.y+dist), TIME)*(maxDist-abs(dist))*1.5;
|
||||
}
|
||||
|
||||
staticVal *= bottomStaticOpt;
|
||||
|
||||
float red = texture(SCREEN_TEXTURE, vec2(uv.x + xOffset -0.01*rgbOffsetOpt,_y)).r+staticVal;
|
||||
float green = texture(SCREEN_TEXTURE, vec2(uv.x + xOffset,_y)).g+staticVal;
|
||||
float blue = texture(SCREEN_TEXTURE, vec2(uv.x + xOffset +0.01*rgbOffsetOpt,_y)).b+staticVal;
|
||||
|
||||
vec3 color = vec3(red,green,blue);
|
||||
float scanline = sin(uv.y*800.0)*0.04*scalinesOpt;
|
||||
color -= scanline;
|
||||
|
||||
COLOR = vec4(color,1.0);
|
||||
}
|
||||
86
GodotRetro/Screen Shaders/VHS.shader
Executable file
@@ -0,0 +1,86 @@
|
||||
//SHADER ORIGINALY CREADED BY "FMS_Cat" FROM SHADERTOY
|
||||
//MODIFIED AND PORTED TO GODOT BY AHOPNESS (@ahopness)
|
||||
//LICENSE : CC0
|
||||
//COMATIBLE WITH : GLES2, GLES3
|
||||
//SHADERTOY LINK : https://www.shadertoy.com/view/XtBXDt
|
||||
|
||||
shader_type canvas_item;
|
||||
|
||||
uniform float tape_wave_amount :hint_range (0, .04) = 0.003;
|
||||
uniform float tape_crease_amount :hint_range (0, 15) = 2.5;
|
||||
uniform float color_displacement :hint_range (0, 5) = 1;
|
||||
uniform float lines_velocity :hint_range (0, 5) = 0.1;
|
||||
|
||||
const float PI = 3.14159265;
|
||||
|
||||
vec3 tex2D( sampler2D _tex, vec2 _p ){
|
||||
vec3 col = texture( _tex, _p ).xyz;
|
||||
if ( 0.5 < abs( _p.x - 0.5 ) ) {
|
||||
col = vec3( 0.1 );
|
||||
}
|
||||
return col;
|
||||
}
|
||||
|
||||
float hash( vec2 _v ){
|
||||
return fract( sin( dot( _v, vec2( 89.44, 19.36 ) ) ) * 22189.22 );
|
||||
}
|
||||
|
||||
float iHash( vec2 _v, vec2 _r ){
|
||||
float h00 = hash( vec2( floor( _v * _r + vec2( 0.0, 0.0 ) ) / _r ) );
|
||||
float h10 = hash( vec2( floor( _v * _r + vec2( 1.0, 0.0 ) ) / _r ) );
|
||||
float h01 = hash( vec2( floor( _v * _r + vec2( 0.0, 1.0 ) ) / _r ) );
|
||||
float h11 = hash( vec2( floor( _v * _r + vec2( 1.0, 1.0 ) ) / _r ) );
|
||||
vec2 ip = vec2( smoothstep( vec2( 0.0, 0.0 ), vec2( 1.0, 1.0 ), mod( _v*_r, 1. ) ) );
|
||||
return ( h00 * ( 1. - ip.x ) + h10 * ip.x ) * ( 1. - ip.y ) + ( h01 * ( 1. - ip.x ) + h11 * ip.x ) * ip.y;
|
||||
}
|
||||
|
||||
float noise( vec2 _v ){
|
||||
float sum = 0.;
|
||||
for( float i=1.0; i<9.0; i++ ){
|
||||
sum += iHash( _v + vec2( i ), vec2( 2. * pow( 2., float( i ) ) ) ) / pow( 2., float( i ) );
|
||||
}
|
||||
return sum;
|
||||
}
|
||||
|
||||
void fragment(){
|
||||
vec2 uv = FRAGCOORD.xy / (1.0 / SCREEN_PIXEL_SIZE).xy;
|
||||
vec2 uvn = uv;
|
||||
vec3 col = vec3( 0.0 );
|
||||
|
||||
// tape wave
|
||||
uvn.x += ( noise( vec2( uvn.y, TIME ) ) - 0.5 )* 0.005;
|
||||
uvn.x += ( noise( vec2( uvn.y * 100.0, TIME * 10.0 ) ) - 0.5 ) * tape_wave_amount;
|
||||
|
||||
// tape crease
|
||||
float tcPhase = clamp( ( sin( uvn.y * 8.0 - TIME * PI * 1.2 ) - 0.92 ) * noise( vec2( TIME ) ), 0.0, 0.01 ) * tape_crease_amount;
|
||||
float tcNoise = max( noise( vec2( uvn.y * 100.0, TIME * 10.0 ) ) - 0.5, 0.0 );
|
||||
uvn.x = uvn.x - tcNoise * tcPhase;
|
||||
|
||||
// switching noise
|
||||
float snPhase = smoothstep( 0.03, 0.0, uvn.y );
|
||||
uvn.y += snPhase * 0.3;
|
||||
uvn.x += snPhase * ( ( noise( vec2( uv.y * 100.0, TIME * 10.0 ) ) - 0.5 ) * 0.2 );
|
||||
|
||||
col = tex2D( SCREEN_TEXTURE, uvn );
|
||||
col *= 1.0 - tcPhase;
|
||||
col = mix(
|
||||
col,
|
||||
col.yzx,
|
||||
snPhase
|
||||
);
|
||||
|
||||
// bloom
|
||||
for( float x = -4.0; x < 2.5; x += 1.0 ){
|
||||
col.xyz += vec3(
|
||||
tex2D( SCREEN_TEXTURE, uvn + vec2( x - 0.0, 0.0 ) * 0.007 ).x,
|
||||
tex2D( SCREEN_TEXTURE, uvn + vec2( x - color_displacement, 0.0 ) * 0.007 ).y,
|
||||
tex2D( SCREEN_TEXTURE, uvn + vec2( x - color_displacement * 2.0, 0.0 ) * 0.007 ).z
|
||||
) * 0.1;
|
||||
}
|
||||
col *= 0.6;
|
||||
|
||||
// ac beat
|
||||
col *= 1.0 + clamp( noise( vec2( 0.0, uv.y + TIME * lines_velocity ) ) * 0.6 - 0.25, 0.0, 0.1 );
|
||||
|
||||
COLOR = vec4( col, 1.0 );
|
||||
}
|
||||
43
GodotRetro/Screen Shaders/VHSPause.shader
Executable file
@@ -0,0 +1,43 @@
|
||||
//SHADER ORIGINALY CREADED BY "caaaaaaarter" FROM SHADERTOY
|
||||
//MODIFIED AND PORTED TO GODOT BY AHOPNESS (@ahopness)
|
||||
//LICENSE : CC0
|
||||
//COMATIBLE WITH : GLES2, GLES3
|
||||
//SHADERTOY LINK : https://www.shadertoy.com/view/4lB3Dc
|
||||
|
||||
shader_type canvas_item;
|
||||
|
||||
uniform float shake_amount_x : hint_range(1, 500) = 250.0;
|
||||
uniform float shake_amount_y : hint_range(1, 500) = 40.0;
|
||||
uniform float white_hlines : hint_range(0, 50) = 50;
|
||||
uniform float white_vlines : hint_range(0,80) = 80;
|
||||
|
||||
float rand(vec2 co){
|
||||
return fract(sin(dot(co.xy ,vec2(12.9898,78.233))) * 43758.5453);
|
||||
}
|
||||
|
||||
void fragment(){
|
||||
vec4 texColor = vec4(0);
|
||||
// get position to sample
|
||||
vec2 samplePosition = FRAGCOORD.xy / (1.0 / SCREEN_PIXEL_SIZE).xy;
|
||||
|
||||
float whiteNoise = 9999.0;
|
||||
|
||||
// Jitter each line left and right
|
||||
samplePosition.x = samplePosition.x+(rand(vec2(TIME,UV.y))-0.5)/shake_amount_x;
|
||||
// Jitter the whole picture up and down
|
||||
samplePosition.y = samplePosition.y+(rand(vec2(TIME))-0.5)/shake_amount_y;
|
||||
// Slightly add color noise to each line
|
||||
texColor = texColor + (vec4(-0.5)+vec4(rand(vec2(UV.y,TIME)),rand(vec2(UV.y,TIME+1.0)),rand(vec2(UV.y,TIME+2.0)),0))*0.1;
|
||||
|
||||
// Either sample the texture, or just make the pixel white (to get the staticy-bit at the bottom)
|
||||
whiteNoise = rand(vec2(floor(samplePosition.y*white_vlines),floor(samplePosition.x*white_hlines))+vec2(TIME,0));
|
||||
if (whiteNoise > 11.5-30.0*samplePosition.y || whiteNoise < 1.5-5.0*samplePosition.y) {
|
||||
// Sample the texture.
|
||||
//samplePosition.y = 1.0-samplePosition.y; //Fix for upside-down texture
|
||||
texColor = texColor + texture(SCREEN_TEXTURE,samplePosition);
|
||||
}else{
|
||||
// Use white. (I'm adding here so the color noise still applies)
|
||||
texColor = vec4(1);
|
||||
}
|
||||
COLOR = texColor;
|
||||
}
|
||||
11
addons/zylann.hterrain/LICENSE.md
Executable file
@@ -0,0 +1,11 @@
|
||||
HeightMap terrain for Godot Engine
|
||||
------------------------------------
|
||||
|
||||
Copyright (c) 2016-2023 Marc Gilleron
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
|
||||
0
addons/zylann.hterrain/doc/.gdignore
Executable file
BIN
addons/zylann.hterrain/doc/docs/images/alpha_blending_and_depth_blending.png
Executable file
|
After Width: | Height: | Size: 313 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/bad_array_blending.png
Executable file
|
After Width: | Height: | Size: 119 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/brush_editor.png
Executable file
|
After Width: | Height: | Size: 3.2 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/channel_packer.png
Executable file
|
After Width: | Height: | Size: 16 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/choose_bullet_physics.png
Executable file
|
After Width: | Height: | Size: 31 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/color_painting.png
Executable file
|
After Width: | Height: | Size: 338 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/data_directory_property.png
Executable file
|
After Width: | Height: | Size: 8.2 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/default_terrain.png
Executable file
|
After Width: | Height: | Size: 12 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/detail_layers.png
Executable file
|
After Width: | Height: | Size: 722 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/dilation.png
Executable file
|
After Width: | Height: | Size: 54 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/erosion_slope.png
Executable file
|
After Width: | Height: | Size: 118 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/erosion_steps.png
Executable file
|
After Width: | Height: | Size: 199 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/generator.png
Executable file
|
After Width: | Height: | Size: 43 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/gimp_png_preserve_colors.png
Executable file
|
After Width: | Height: | Size: 8.4 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/grass_models.png
Executable file
|
After Width: | Height: | Size: 207 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/hole_painting.png
Executable file
|
After Width: | Height: | Size: 238 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/ignore_tools_on_export.png
Executable file
|
After Width: | Height: | Size: 14 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/importer.png
Executable file
|
After Width: | Height: | Size: 17 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/inspector_texture_set.png
Executable file
|
After Width: | Height: | Size: 250 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/inspector_texture_set_save.png
Executable file
|
After Width: | Height: | Size: 28 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/lod_geometry.png
Executable file
|
After Width: | Height: | Size: 405 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/lookdev_grass.png
Executable file
|
After Width: | Height: | Size: 724 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/lookdev_menu.png
Executable file
|
After Width: | Height: | Size: 225 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/lots_of_textures_blending.png
Executable file
|
After Width: | Height: | Size: 180 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/low_poly.png
Executable file
|
After Width: | Height: | Size: 228 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/normalmap_conventions.png
Executable file
|
After Width: | Height: | Size: 55 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/overview.png
Executable file
|
After Width: | Height: | Size: 426 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/panel_import_button.png
Executable file
|
After Width: | Height: | Size: 14 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/panel_textures_edit_button.png
Executable file
|
After Width: | Height: | Size: 28 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/pbr_textures.png
Executable file
|
After Width: | Height: | Size: 168 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/resize_tool.png
Executable file
|
After Width: | Height: | Size: 5.3 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/sculpting_tools.png
Executable file
|
After Width: | Height: | Size: 16 KiB |
|
After Width: | Height: | Size: 216 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/slope_limit_tool.png
Executable file
|
After Width: | Height: | Size: 11 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/splatmap_and_textured_result.png
Executable file
|
After Width: | Height: | Size: 94 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/texture_array_import_dock.png
Executable file
|
After Width: | Height: | Size: 8.8 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/texture_atlas_example.png
Executable file
|
After Width: | Height: | Size: 46 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/texture_dialog.png
Executable file
|
After Width: | Height: | Size: 53 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/texture_set_editor.png
Executable file
|
After Width: | Height: | Size: 150 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/texture_set_import_tool.png
Executable file
|
After Width: | Height: | Size: 45 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/texture_set_import_tool_directory.png
Executable file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/texture_set_import_tool_success.png
Executable file
|
After Width: | Height: | Size: 7.9 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/texture_set_import_tool_texture_types.png
Executable file
|
After Width: | Height: | Size: 149 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/texture_slots.png
Executable file
|
After Width: | Height: | Size: 6.2 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/tiling_artifacts.png
Executable file
|
After Width: | Height: | Size: 1.5 MiB |
BIN
addons/zylann.hterrain/doc/docs/images/tiling_reduction.png
Executable file
|
After Width: | Height: | Size: 1.0 MiB |
BIN
addons/zylann.hterrain/doc/docs/images/transition_array_blending.png
Executable file
|
After Width: | Height: | Size: 132 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/update_editor_collider.png
Executable file
|
After Width: | Height: | Size: 110 KiB |
BIN
addons/zylann.hterrain/doc/docs/images/warped_checker_variations.png
Executable file
|
After Width: | Height: | Size: 816 KiB |
1166
addons/zylann.hterrain/doc/docs/index.md
Executable file
11
addons/zylann.hterrain/doc/mkdocs.yml
Executable file
@@ -0,0 +1,11 @@
|
||||
site_name: HTerrain plugin documentation
|
||||
theme: readthedocs
|
||||
|
||||
markdown_extensions:
|
||||
# Makes permalinks appear on headings
|
||||
- toc:
|
||||
permalink: True
|
||||
# Makes boxes for notes and warnings
|
||||
- admonition
|
||||
# Better highlighter which supports GDScript
|
||||
- codehilite
|
||||
1
addons/zylann.hterrain/doc/requirements.txt
Executable file
@@ -0,0 +1 @@
|
||||
mkdocs>=1.1.2
|
||||
1665
addons/zylann.hterrain/hterrain.gd
Executable file
1
addons/zylann.hterrain/hterrain.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://dp5xpux4ixqlp
|
||||
125
addons/zylann.hterrain/hterrain_chunk.gd
Executable file
@@ -0,0 +1,125 @@
|
||||
@tool
|
||||
|
||||
var cell_origin_x := 0
|
||||
var cell_origin_y := 0
|
||||
|
||||
var _visible : bool
|
||||
# This is true when the chunk is meant to be displayed.
|
||||
# A chunk can be active and hidden (due to the terrain being hidden).
|
||||
var _active : bool
|
||||
|
||||
var _pending_update : bool
|
||||
|
||||
var _mesh_instance : RID
|
||||
# Need to keep a reference so that the mesh RID doesn't get freed
|
||||
# TODO Use RID directly, no need to keep all those meshes in memory
|
||||
var _mesh : Mesh = null
|
||||
|
||||
|
||||
# TODO p_parent is HTerrain, can't add type hint due to cyclic reference
|
||||
func _init(p_parent: Node3D, p_cell_x: int, p_cell_y: int, p_material: Material):
|
||||
assert(p_parent is Node3D)
|
||||
assert(typeof(p_cell_x) == TYPE_INT)
|
||||
assert(typeof(p_cell_y) == TYPE_INT)
|
||||
assert(p_material is Material)
|
||||
|
||||
cell_origin_x = p_cell_x
|
||||
cell_origin_y = p_cell_y
|
||||
|
||||
var rs := RenderingServer
|
||||
|
||||
_mesh_instance = rs.instance_create()
|
||||
|
||||
if p_material != null:
|
||||
rs.instance_geometry_set_material_override(_mesh_instance, p_material.get_rid())
|
||||
|
||||
var world := p_parent.get_world_3d()
|
||||
if world != null:
|
||||
rs.instance_set_scenario(_mesh_instance, world.get_scenario())
|
||||
|
||||
_visible = true
|
||||
# TODO Is this needed?
|
||||
rs.instance_set_visible(_mesh_instance, _visible)
|
||||
|
||||
_active = true
|
||||
_pending_update = false
|
||||
|
||||
|
||||
func _notification(p_what: int):
|
||||
if p_what == NOTIFICATION_PREDELETE:
|
||||
if _mesh_instance != RID():
|
||||
RenderingServer.free_rid(_mesh_instance)
|
||||
_mesh_instance = RID()
|
||||
|
||||
|
||||
func is_active() -> bool:
|
||||
return _active
|
||||
|
||||
|
||||
func set_active(a: bool):
|
||||
_active = a
|
||||
|
||||
|
||||
func is_pending_update() -> bool:
|
||||
return _pending_update
|
||||
|
||||
|
||||
func set_pending_update(p: bool):
|
||||
_pending_update = p
|
||||
|
||||
|
||||
func enter_world(world: World3D):
|
||||
assert(_mesh_instance != RID())
|
||||
RenderingServer.instance_set_scenario(_mesh_instance, world.get_scenario())
|
||||
|
||||
|
||||
func exit_world():
|
||||
assert(_mesh_instance != RID())
|
||||
RenderingServer.instance_set_scenario(_mesh_instance, RID())
|
||||
|
||||
|
||||
func parent_transform_changed(parent_transform: Transform3D):
|
||||
assert(_mesh_instance != RID())
|
||||
var local_transform := Transform3D(Basis(), Vector3(cell_origin_x, 0, cell_origin_y))
|
||||
var world_transform := parent_transform * local_transform
|
||||
RenderingServer.instance_set_transform(_mesh_instance, world_transform)
|
||||
|
||||
|
||||
func set_mesh(mesh: Mesh):
|
||||
assert(_mesh_instance != RID())
|
||||
if mesh == _mesh:
|
||||
return
|
||||
RenderingServer.instance_set_base(_mesh_instance, mesh.get_rid() if mesh != null else RID())
|
||||
_mesh = mesh
|
||||
|
||||
|
||||
func set_material(material: Material):
|
||||
assert(_mesh_instance != RID())
|
||||
RenderingServer.instance_geometry_set_material_override( \
|
||||
_mesh_instance, material.get_rid() if material != null else RID())
|
||||
|
||||
|
||||
func set_visible(visible: bool):
|
||||
assert(_mesh_instance != RID())
|
||||
RenderingServer.instance_set_visible(_mesh_instance, visible)
|
||||
_visible = visible
|
||||
|
||||
|
||||
func is_visible() -> bool:
|
||||
return _visible
|
||||
|
||||
|
||||
func set_aabb(aabb: AABB):
|
||||
assert(_mesh_instance != RID())
|
||||
RenderingServer.instance_set_custom_aabb(_mesh_instance, aabb)
|
||||
|
||||
|
||||
func set_render_layer_mask(mask: int):
|
||||
assert(_mesh_instance != RID())
|
||||
RenderingServer.instance_set_layer_mask(_mesh_instance, mask)
|
||||
|
||||
|
||||
func set_cast_shadow_setting(setting: int):
|
||||
assert(_mesh_instance != RID())
|
||||
RenderingServer.instance_geometry_set_cast_shadows_setting(_mesh_instance, setting)
|
||||
|
||||
1
addons/zylann.hterrain/hterrain_chunk.gd.uid
Normal file
@@ -0,0 +1 @@
|
||||
uid://due1nxh1rsvxx
|
||||