i got it working yay! there was a problem with my triplanar calculation in the shader.
works fine now, i didnt had to set normal to disabled
shader_type spatial;
render_mode blend_mix,depth_draw_opaque,cull_back,diffuse_burley,specular_schlick_ggx;
uniform sampler2D texture_albedo : source_color,filter_linear_mipmap,repeat_enable;
uniform sampler2D texture_roughness : hint_roughness_gray,filter_linear_mipmap,repeat_enable;
uniform sampler2D texture_normal : hint_roughness_normal,filter_linear_mipmap,repeat_enable;
uniform float roughness = 1.0;
uniform sampler2D detail_normal : hint_roughness_normal,filter_linear_mipmap,repeat_enable;
uniform sampler2D detail_overlay : source_color,filter_linear_mipmap,repeat_enable;
uniform vec3 detail_scale = vec3(1.0);
uniform float normal_scale = 1.0;
varying vec3 triplanar_pos;
varying vec3 power_normal;
void vertex() {
TANGENT = vec3(0.0,0.0,-1.0) * abs(NORMAL.x);
TANGENT += vec3(1.0,0.0,0.0) * abs(NORMAL.y);
TANGENT += vec3(1.0,0.0,0.0) * abs(NORMAL.z);
TANGENT = normalize(TANGENT);
BINORMAL = vec3(0.0,1.0,0.0) * abs(NORMAL.x);
BINORMAL += vec3(0.0,0.0,-1.0) * abs(NORMAL.y);
BINORMAL += vec3(0.0,1.0,0.0) * abs(NORMAL.z);
BINORMAL = normalize(BINORMAL);
power_normal = pow(abs(NORMAL),vec3(1.0));
triplanar_pos = VERTEX;
power_normal /= dot(power_normal,vec3(1.0));
triplanar_pos *= vec3(1.0,-1.0, 1.0);
}
vec3 triplanar_texture(sampler2D p_sampler, vec3 p_triplanar_pos) {
vec3 samp = vec3(0.0);
samp += texture(p_sampler,p_triplanar_pos.xy).xyz * power_normal.z;
samp += texture(p_sampler,p_triplanar_pos.xz).xyz * power_normal.y;
samp += texture(p_sampler,p_triplanar_pos.zy * vec2(-1.0,1.0)).xyz * power_normal.x;
return samp;
}
//Overlay
vec3 overlay (vec3 target, vec3 blend){
vec3 temp;
temp.x = (target.x > 0.5) ? (1.0-(1.0-2.0*(target.x-0.5))*(1.0-blend.x)) : (2.0*target.x)*blend.x;
temp.y = (target.y > 0.5) ? (1.0-(1.0-2.0*(target.y-0.5))*(1.0-blend.y)) : (2.0*target.y)*blend.y;
temp.z = (target.z > 0.5) ? (1.0-(1.0-2.0*(target.z-0.5))*(1.0-blend.z)) : (2.0*target.z)*blend.z;
return temp;
}
// Linear Blending
vec3 NormalBlend_Linear(vec3 n1, vec3 n2)
{
// Unpack
n1 = n1*2.0 - 1.0;
n2 = n2*2.0 - 1.0;
return normalize(n1 + n2);
}
vec3 CombineNormal(vec3 n1, vec3 n2)
{
return NormalBlend_Linear(n1, n2);
}
void fragment() {
vec2 base_uv = UV;
vec4 albedo_tex = texture(texture_albedo,base_uv);
vec3 overlayertex = triplanar_texture(detail_overlay,triplanar_pos * detail_scale/100.0);
ALBEDO = overlay(albedo_tex.rgb,overlayertex.rgb);
METALLIC = 0.0;
vec4 roughness_texture_channel = vec4(0.333333,0.333333,0.333333,0.0);
float roughness_tex = dot(texture(texture_roughness,base_uv),roughness_texture_channel);
ROUGHNESS = roughness_tex * roughness;
SPECULAR = 0.5;
vec3 detail_norm_tex = triplanar_texture(detail_normal,triplanar_pos * detail_scale/100.0);
detail_norm_tex *= 2.0;
NORMAL_MAP = CombineNormal(texture(texture_normal,base_uv).rgb,detail_norm_tex.rgb );
NORMAL_MAP_DEPTH = normal_scale;
}