diff --git a/README.md b/README.md index fa7db0c..bf5d780 100644 --- a/README.md +++ b/README.md @@ -28,34 +28,18 @@ The image file will be read and available as the `TEXTURE` variable. ```glsl //!load+ + uniform sampler2D ; ``` -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); -} -``` +Have a look at the `place_texture.gdshader` example. ## 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. -Here is an example on how to use it (the `hsv.gdshader` example): +Here is an example: ```glsl shader_type canvas_item; diff --git a/project.godot b/project.godot index f6f242c..775ef99 100644 --- a/project.godot +++ b/project.godot @@ -11,7 +11,7 @@ config_version=5 [application] config/name="Fragmented" -config/version="v5.0" +config/version="v6.0" run/main_scene="res://scenes/main.tscn" config/features=PackedStringArray("4.3", "Mobile") run/low_processor_mode=true diff --git a/screenshot.png b/screenshot.png index 551bf4d..62b1635 100644 Binary files a/screenshot.png and b/screenshot.png differ diff --git a/shaderlib/hsv.gdshaderinc b/shaderlib/hsv.gdshaderinc index 6d77455..e1d9fdc 100644 --- a/shaderlib/hsv.gdshaderinc +++ b/shaderlib/hsv.gdshaderinc @@ -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) vec4 rgb2hsv(vec4 c) { diff --git a/shaderlib/transparency.gdshaderinc b/shaderlib/transparency.gdshaderinc index d03949d..220f0ba 100644 --- a/shaderlib/transparency.gdshaderinc +++ b/shaderlib/transparency.gdshaderinc @@ -1,7 +1,6 @@ // Alpha Blending a over b after Bruce A. Wallace -// sources: -// - https://en.wikipedia.org/wiki/Alpha_compositing +// source: https://en.wikipedia.org/wiki/Alpha_compositing vec4 alpha_blend(vec4 b, vec4 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);