rj-action-library/Runtime/Shading/Library/Textures.gdshaderinc

11 lines
347 B
Plaintext

vec4 triplanarTexture( sampler2D sampler, vec3 weights, vec3 triplanerPosition )
{
vec4 sample = vec4( 0.0 );
sample += texture( sampler, triplanerPosition.xy ) * weights.z;
sample += texture( sampler, triplanerPosition.xz ) * weights.y;
sample += texture( sampler, triplanerPosition.zy * vec2( -1.0, 1.0 ) ) * weights.x;
return sample;
}