Layer SplatMap

Minimalist shader for blending textures using RGBA masks.

Shader code
shader_type spatial;
render_mode cull_back, diffuse_lambert, specular_disabled;

uniform float UV_Scale_Tex1 = 15.0;
uniform float UV_Scale_Tex2 = 15.0;
uniform float UV_Scale_Tex3 = 15.0;

uniform sampler2D Tex;
uniform sampler2D Tex2;
uniform sampler2D SplatMap;
uniform sampler2D Tex3;

void fragment() {
	vec2 n_out15p0 = UV;

	vec3 uv_tex1 = vec3(n_out15p0, 0.0) * vec3(UV_Scale_Tex1);
	vec4 n_out4p0 = texture(Tex, vec2(uv_tex1.xy));

	vec3 uv_tex2 = vec3(n_out15p0, 0.0) * vec3(UV_Scale_Tex2);
	vec4 n_out7p0 = texture(Tex2, vec2(uv_tex2.xy));

	vec3 uv_tex3 = vec3(n_out15p0, 0.0) * vec3(UV_Scale_Tex3);
	vec4 n_out9p0 = texture(Tex3, vec2(uv_tex3.xy));

	vec4 n_out11p0 = texture(SplatMap, UV);

	float n_out12p0 = vec3(n_out11p0.xyz).x;
	float n_out12p1 = vec3(n_out11p0.xyz).y;
	float n_out12p2 = vec3(n_out11p0.xyz).z;

	vec3 n_out13p0 = mix(vec3(n_out4p0.xyz), vec3(n_out7p0.xyz), vec3(n_out12p0));

	vec3 n_out14p0 = mix(n_out13p0, vec3(n_out9p0.xyz), vec3(n_out12p1));

	ALBEDO = n_out14p0;
}
Tags
mask, splat, splatmap, splatmask, terrain
The shader code and all code snippets in this post are under CC0 license and can be used freely without the author's permission. Images and videos, and assets depicted in those, do not fall under this license. For more info, see our License terms.

More from AivanWorld

Screen Warping

Noise & Grain

CrossHairPoint (Round) : Godot 4.3

Related shaders

godot4 5 layer splatmap shader for terrain or something..

Simple Splat-map Shader for 3D Terrain (uses Vertex colors as splatmap)

Gaussian blur for Godot 4.3 Canvase layer

guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments