// Triplanar mapping sampler fn TriSampler(tex: texture_2d, tex_sampler: sampler, position: vec3, normal: vec3, sharpness: f32) -> vec3 { let uv_x = position.yz; let uv_y = position.xz; let uv_z = position.xy; let tri_mask: vec3 = normalize(pow(abs(normal), vec3(sharpness))); let sample_x = textureSample(tex, tex_sampler, uv_x).rgb; let sample_y = textureSample(tex, tex_sampler, uv_y).rgb; let sample_z = textureSample(tex, tex_sampler, uv_z).rgb; return (sample_x * tri_mask.x) + (sample_y * tri_mask.y) + (sample_z * tri_mask.z); }