Bump version to v6.0, update & improve README, add new screenshot, and more; closes #19

This commit is contained in:
ChaoticByte 2025-01-01 21:43:32 +01:00
parent afea5c9727
commit 01e17bd6e3
No known key found for this signature in database
5 changed files with 9 additions and 24 deletions

View file

@ -28,34 +28,18 @@ The image file will be read and available as the `TEXTURE` variable.
```glsl ```glsl
//!load+ <name> <filepath> //!load+ <name> <filepath>
uniform sampler2D <name>; uniform sampler2D <name>;
``` ```
Have a look at the `place_texture.gdshader` example: Have a look at the `place_texture.gdshader` example.
```glsl
shader_type canvas_item;
#include "res://shaderlib/transform.gdshaderinc"
//!load ./swamp.jpg
//!load+ img2 ./grass.png
uniform sampler2D img2: repeat_disable, filter_nearest;
void fragment() {
vec4 grass = place_texture(img2, UV, TEXTURE_PIXEL_SIZE, vec2(0, .47), vec2(1));
grass.rgb += (vec3(0.03, 0.07, 0.11) - ((UV.y - .8) * 0.15)); // color correction
COLOR.rgb = mix(COLOR.rgb, grass.rgb, grass.a);
}
```
## Shaderlib ## Shaderlib
This repo comes with a (still small) shader library including pre-written functions and more. This repo comes with a (still small) shader library including pre-written functions and more.
Have a look at the `shaderlib` folder. Have a look at the `shaderlib` folder.
Here is an example on how to use it (the `hsv.gdshader` example): Here is an example:
```glsl ```glsl
shader_type canvas_item; shader_type canvas_item;

View file

@ -11,7 +11,7 @@ config_version=5
[application] [application]
config/name="Fragmented" config/name="Fragmented"
config/version="v5.0" config/version="v6.0"
run/main_scene="res://scenes/main.tscn" run/main_scene="res://scenes/main.tscn"
config/features=PackedStringArray("4.3", "Mobile") config/features=PackedStringArray("4.3", "Mobile")
run/low_processor_mode=true run/low_processor_mode=true

Binary file not shown.

Before

Width:  |  Height:  |  Size: 669 KiB

After

Width:  |  Height:  |  Size: 635 KiB

Before After
Before After

View file

@ -1,5 +1,7 @@
// rgb2hsv and hsv2rgb functions adapted from https://godotshaders.com/shader/hsv-adjustment/ // rgb2hsv and hsv2rgb functions adapted
// from https://godotshaders.com/shader/hsv-adjustment/
// original code by https://godotshaders.com/author/al1-ce/
// Convert RGB to HSV (hue, saturation, brightness) // Convert RGB to HSV (hue, saturation, brightness)
vec4 rgb2hsv(vec4 c) { vec4 rgb2hsv(vec4 c) {

View file

@ -1,7 +1,6 @@
// Alpha Blending a over b after Bruce A. Wallace // Alpha Blending a over b after Bruce A. Wallace
// sources: // source: https://en.wikipedia.org/wiki/Alpha_compositing
// - https://en.wikipedia.org/wiki/Alpha_compositing
vec4 alpha_blend(vec4 b, vec4 a) { vec4 alpha_blend(vec4 b, vec4 a) {
float alpha = a.a + (b.a * (1.0 - a.a)); float alpha = a.a + (b.a * (1.0 - a.a));
vec3 col = ((a.rgb*a.a) + ((b.rgb*b.a) * (1.0 - a.a)) / alpha); vec3 col = ((a.rgb*a.a) + ((b.rgb*b.a) * (1.0 - a.a)) / alpha);