Removed presets, load all images via load directives (implements #9), removed obsolete code, added some improvements

This commit is contained in:
ChaoticByte 2024-12-19 18:52:47 +01:00
parent 53d42de4a5
commit 4b28a6427e
No known key found for this signature in database
21 changed files with 231 additions and 205 deletions

5
examples/CREDITS.md Normal file
View file

@ -0,0 +1,5 @@
# Example Images
- swamp.jpg by [clfr21](https://pixabay.com/de/users/clfr21-6530007/)
- overlay.jpg by [Humusak](https://pixabay.com/de/users/humusak-137455/)

View file

@ -0,0 +1,14 @@
shader_type canvas_item;
//!load ./swamp.jpg
const vec2 offset_r = vec2(-0.002, -0.002);
const vec2 offset_g = vec2(0., 0.);
const vec2 offset_b = vec2(0.002, 0.002);
void fragment() {
COLOR.r = texture(TEXTURE , UV + offset_r).r;
COLOR.g = texture(TEXTURE , UV + offset_g).g;
COLOR.b = texture(TEXTURE , UV + offset_b).b;
COLOR.a = COLOR.a;
}

View file

@ -0,0 +1,10 @@
shader_type canvas_item;
//!load ./swamp.jpg
void fragment() {
float b = (COLOR.r + COLOR.g + COLOR.b) / 3.0;
COLOR.r = b;
COLOR.g = b;
COLOR.b = b;
}

15
examples/lowpass.gdshader Normal file
View file

@ -0,0 +1,15 @@
shader_type canvas_item;
//!load ./swamp.jpg
// Settings
const float threshold = 0.5;
//
void fragment() {
vec4 tex = texture(TEXTURE , UV);
COLOR.r = min(tex.r, threshold);
COLOR.g = min(tex.g, threshold);
COLOR.b = min(tex.b, threshold);
COLOR.a = tex.a;
}

10
examples/mix.gdshader Normal file
View file

@ -0,0 +1,10 @@
shader_type canvas_item;
//!load ./swamp.jpg
//!load+ img2 ./overlay.jpg
uniform sampler2D img2: repeat_enable, filter_nearest;
void fragment() {
COLOR = mix(COLOR, texture(img2, UV), .2);
}

BIN
examples/overlay.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 896 KiB

View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://8101nnc8cx4o"
path="res://.godot/imported/overlay.jpg-b6d13e0def59877969c9eda02fa4244e.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://examples/overlay.jpg"
dest_files=["res://.godot/imported/overlay.jpg-b6d13e0def59877969c9eda02fa4244e.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

View file

@ -0,0 +1,13 @@
shader_type canvas_item;
//!load ./swamp.jpg
const float strength = 0.1;
void fragment() {
vec2 uv = UV;
float b = (COLOR.r + COLOR.g + COLOR.b) / 3.0;
uv.x = mix(uv.x, b, strength);
uv.y = mix(uv.y, b, strength);
COLOR = texture(TEXTURE, uv);
}

BIN
examples/swamp.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 477 KiB

34
examples/swamp.jpg.import Normal file
View file

@ -0,0 +1,34 @@
[remap]
importer="texture"
type="CompressedTexture2D"
uid="uid://ckjb0agn5btv7"
path="res://.godot/imported/swamp.jpg-8e3eac7e7aacce65638e712310cdb35c.ctex"
metadata={
"vram_texture": false
}
[deps]
source_file="res://examples/swamp.jpg"
dest_files=["res://.godot/imported/swamp.jpg-8e3eac7e7aacce65638e712310cdb35c.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