shaderlib: Implement place_texture() and provide an example, replace mix.gdshader example; implements #17
This commit is contained in:
parent
8b5a1cc37d
commit
1aa217776c
8 changed files with 48 additions and 21 deletions
14
examples/place_texture.gdshader
Normal file
14
examples/place_texture.gdshader
Normal file
|
@ -0,0 +1,14 @@
|
|||
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);
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue