Hello,

I was looking for an alternative for tri-planar mapping because it's a little heavy. After some searching I found Bi-planar mapping which is a little cheaper but still looks good enough.

https://www.iquilezles.org/www/articles/biplanar/biplanar.htm

But I have trouble of re-creating the shader in Godot. The function below seems not supported, is there a way to work around this?

ivec3 ma = (n.x>n.y && n.x>n.z) ? ivec3(0,1,2) : (n.y>n.z) ? ivec3(1,2,0) : ivec3(2,0,1) ;

It looks like a series of ternary if statements. Breaking it down into if and else statements should fix the issue (untested):

vec3 ma;
if (n.x > n.y && n.x > n.z) {
   ma vec3(0, 1, 2)
} else if (n.y > n.z) {
   ma = vec3(1, 2, 0);
} else {
   ma = vec3(2, 0, 1);
}
2 years later