shaderlib: Add alpha_blend function, extend place_texture example, update autocomplete - implements #23

This commit is contained in:
ChaoticByte 2024-12-30 17:02:19 +01:00
parent 3abaf38400
commit 1635cd5b82
No known key found for this signature in database
3 changed files with 21 additions and 8 deletions

View file

@ -1,6 +1,7 @@
shader_type canvas_item;
#include "res://shaderlib/transform.gdshaderinc"
#include "res://shaderlib/transparency.gdshaderinc"
//!load ./swamp.jpg
//!load+ img2 ./grass.png
@ -9,6 +10,6 @@ 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);
grass.rgb += (vec3(0.02, 0.07, 0.1) - ((UV.y - .8) * 0.15)); // color correction
COLOR = alpha_blend(COLOR, grass);
}