Material with the ability to select a different texture for the inside of the wall.
- The inside and outside textures can be blended with any other textures.
- Each of the 4 possible textures has all possible maps and settings.
- The selection of the inside wall for texture display can be changed in the "Global Settings" tab, under the "Inner Face" option.
- Custom masks can be used for blending (not accurate).
*** To use the same material on walls in different planes, MAKE UNIQUE the material and change the "Inner Face" parameter individually ***
shader_type spatial;
render_mode blend_mix, depth_draw_opaque, cull_back, diffuse_burley, specular_schlick_ggx;
group_uniforms Global_Settings;
uniform float specular : hint_range(0.0, 1.0, 0.01);
uniform vec3 uv1_scale = vec3(1.0);
uniform vec3 uv1_offset = vec3(0.0);
uniform float uv1_blend_sharpness : hint_range(0.0, 150.0, 0.001) = 2.0;
uniform int inner_face : hint_range(1, 6, 1) = 1;
uniform vec4 ao_texture_channel;
uniform float ao_light_affect : hint_range(0.0, 1.0, 0.01);
// ==================== OUTSIDE TEXTURES ====================
group_uniforms Outside_Texture;
uniform vec4 albedo_out : source_color;
uniform sampler2D texture_albedo_out : source_color, filter_linear_mipmap_anisotropic, repeat_enable;
uniform float albedo_out_brightness : hint_range(0.0, 2.0, 0.01) = 0.0;
uniform float albedo_out_contrast : hint_range(0.0, 2.0, 0.01) = 1.0;
uniform float albedo_out_saturation : hint_range(0.0, 2.0, 0.01) = 1.0;
uniform float metallic_out : hint_range(0.0, 1.0, 0.01) = 0.0;
uniform sampler2D texture_metallic_out : hint_default_white, filter_linear_mipmap_anisotropic, repeat_enable;
uniform float metallic_out_brightness : hint_range(0.0, 2.0, 0.01) = 0.0;
uniform float metallic_out_contrast : hint_range(0.0, 2.0, 0.01) = 1.0;
uniform float roughness_out : hint_range(0.0, 1.0) = 1.0;
uniform sampler2D texture_roughness_out : hint_roughness_r, filter_linear_mipmap_anisotropic, repeat_enable;
uniform float roughness_out_brightness : hint_range(0.0, 2.0, 0.01) = 0.0;
uniform float roughness_out_contrast : hint_range(0.0, 2.0, 0.01) = 1.0;
uniform sampler2D texture_normal_out : hint_roughness_normal, filter_linear_mipmap_anisotropic, repeat_enable;
uniform float normal_out_strength : hint_range(0.0, 2.0, 0.01) = 1.0;
uniform sampler2D texture_ambient_occlusion_out : hint_default_white, filter_linear_mipmap_anisotropic, repeat_enable;
uniform float ao_out_brightness : hint_range(0.0, 2.0, 0.01) = 0.0;
uniform float ao_out_contrast : hint_range(0.0, 2.0, 0.01) = 1.0;
// ==================== BLEND OUTSIDE ====================
group_uniforms Blend_Outside;
uniform bool Blend_out = false;
uniform sampler2D texture_detail_mask_out : hint_default_white, filter_linear_mipmap_anisotropic, repeat_enable;
uniform int Blend_Mode_out : hint_range(1, 4, 1);
uniform vec3 uv1_scale_blend_out = vec3(1.0);
uniform vec3 uv1_offset_blend_out = vec3(0.0);
uniform sampler2D texture_detail_albedo_out : source_color, filter_linear_mipmap_anisotropic, repeat_enable;
uniform float detail_albedo_out_brightness : hint_range(0.0, 2.0, 0.01) = 0.0;
uniform float detail_albedo_out_contrast : hint_range(0.0, 2.0, 0.01) = 1.0;
uniform float detail_albedo_out_saturation : hint_range(0.0, 2.0, 0.01) = 1.0;
uniform sampler2D texture_detail_normal_out : hint_normal, filter_linear_mipmap_anisotropic, repeat_enable;
uniform float detail_normal_out_strength : hint_range(0.0, 2.0, 0.01) = 1.0;
uniform sampler2D texture_detail_metallic_out : hint_default_white, filter_linear_mipmap_anisotropic, repeat_enable;
uniform float detail_metallic_out_brightness : hint_range(0.0, 2.0, 0.01) = 0.0;
uniform float detail_metallic_out_contrast : hint_range(0.0, 2.0, 0.01) = 1.0;
uniform sampler2D texture_detail_roughness_out : hint_roughness_r, filter_linear_mipmap_anisotropic, repeat_enable;
uniform float detail_roughness_out_brightness : hint_range(0.0, 2.0, 0.01) = 0.0;
uniform float detail_roughness_out_contrast : hint_range(0.0, 2.0, 0.01) = 1.0;
// Noise settings for Blend_Outside
uniform bool use_noise_mask_out = false;
uniform float noise_scale_out : hint_range(0.01, 5.0, 0.01) = 0.1;
uniform float noise_contrast_out : hint_range(0.0, 4.0, 0.01) = 2.0;
uniform float noise_brightness_out : hint_range(-1.0, 1.0, 0.01) = -0.2;
uniform float noise_smoothness_out : hint_range(0.0, 0.5, 0.01) = 0.1;
uniform int noise_octaves_out : hint_range(1, 5, 1) = 1;
uniform float mask_height_out : hint_range(-2.0, 2.0, 0.01) = 0.0;
// ==================== INSIDE TEXTURES ====================
group_uniforms Inside_Texture;
uniform vec4 albedo_inner : source_color;
uniform sampler2D texture_albedo_inner : source_color, filter_linear_mipmap_anisotropic, repeat_enable;
uniform float albedo_inner_brightness : hint_range(0.0, 2.0, 0.01) = 0.0;
uniform float albedo_inner_contrast : hint_range(0.0, 2.0, 0.01) = 1.0;
uniform float albedo_inner_saturation : hint_range(0.0, 2.0, 0.01) = 1.0;
uniform float metallic_inner : hint_range(0.0, 1.0, 0.01) = 0.0;
uniform sampler2D texture_metallic_inner : hint_default_white, filter_linear_mipmap_anisotropic, repeat_enable;
uniform float metallic_inner_brightness : hint_range(0.0, 2.0, 0.01) = 0.0;
uniform float metallic_inner_contrast : hint_range(0.0, 2.0, 0.01) = 1.0;
uniform float roughness_inner : hint_range(0.0, 1.0) = 1.0;
uniform sampler2D texture_roughness_inner : hint_roughness_r, filter_linear_mipmap_anisotropic, repeat_enable;
uniform float roughness_inner_brightness : hint_range(0.0, 2.0, 0.01) = 0.0;
uniform float roughness_inner_contrast : hint_range(0.0, 2.0, 0.01) = 1.0;
uniform sampler2D texture_normal_inner : hint_roughness_normal, filter_linear_mipmap_anisotropic, repeat_enable;
uniform float normal_inner_strength : hint_range(0.0, 2.0, 0.01) = 1.0;
uniform float normal_scale : hint_range(-16.0, 16.0) = 1.0;
uniform sampler2D texture_ambient_occlusion_inner : hint_default_white, filter_linear_mipmap_anisotropic, repeat_enable;
uniform float ao_inner_brightness : hint_range(0.0, 2.0, 0.01) = 0.0;
uniform float ao_inner_contrast : hint_range(0.0, 2.0, 0.01) = 1.0;
// ==================== BLEND INSIDE ====================
group_uniforms Blend_Inside;
uniform bool Blend_inner = false;
uniform sampler2D texture_detail_mask_inner : hint_default_white, filter_linear_mipmap_anisotropic, repeat_enable;
uniform int Blend_Mode_inner : hint_range(1, 4, 1);
uniform vec3 uv1_scale_blend_inner = vec3(1.0);
uniform vec3 uv1_offset_blend_inner = vec3(0.0);
uniform sampler2D texture_detail_albedo_inner : source_color, filter_linear_mipmap_anisotropic, repeat_enable;
uniform float detail_albedo_inner_brightness : hint_range(0.0, 2.0, 0.01) = 0.0;
uniform float detail_albedo_inner_contrast : hint_range(0.0, 2.0, 0.01) = 1.0;
uniform float detail_albedo_inner_saturation : hint_range(0.0, 2.0, 0.01) = 1.0;
uniform sampler2D texture_detail_normal_inner : hint_normal, filter_linear_mipmap_anisotropic, repeat_enable;
uniform float detail_normal_inner_strength : hint_range(0.0, 2.0, 0.01) = 1.0;
uniform sampler2D texture_detail_metallic_inner : hint_default_white, filter_linear_mipmap_anisotropic, repeat_enable;
uniform float detail_metallic_inner_brightness : hint_range(0.0, 2.0, 0.01) = 0.0;
uniform float detail_metallic_inner_contrast : hint_range(0.0, 2.0, 0.01) = 1.0;
uniform sampler2D texture_detail_roughness_inner : hint_roughness_r, filter_linear_mipmap_anisotropic, repeat_enable;
uniform float detail_roughness_inner_brightness : hint_range(0.0, 2.0, 0.01) = 0.0;
uniform float detail_roughness_inner_contrast : hint_range(0.0, 2.0, 0.01) = 1.0;
uniform bool use_noise_mask_inner = false;
uniform float noise_scale_inner : hint_range(0.01, 5.0, 0.01) = 0.1;
uniform float noise_contrast_inner : hint_range(0.0, 4.0, 0.01) = 2.0;
uniform float noise_brightness_inner : hint_range(-1.0, 1.0, 0.01) = -0.2;
uniform float noise_smoothness_inner : hint_range(0.0, 0.5, 0.01) = 0.1;
uniform int noise_octaves_inner : hint_range(1, 5, 1) = 1;
uniform float mask_height_inner : hint_range(-2.0, 2.0, 0.01) = 0.0;
varying vec3 uv1_triplanar_pos;
varying vec3 uv1_power_normal;
varying vec3 world_normal;
varying vec3 uv1_triplanar_pos_blend;
// ==================== UTILITY FUNCTIONS ====================
float apply_contrast_brightness(float value, float contrast, float brightness) {
return clamp((value - 0.5) * contrast + 0.5 + brightness, 0.0, 1.0);
}
vec3 apply_color_correction(vec3 color, float brightness, float contrast, float saturation) {
color = (color - 0.5) * contrast + 0.5 + brightness;
float gray = dot(color, vec3(0.299, 0.587, 0.114));
color = mix(vec3(gray), color, saturation);
return clamp(color, 0.0, 1.0);
}
vec3 apply_normal_correction(vec3 normal, float strength) {
vec3 corrected = normal * 2.0 - 1.0;
corrected.xy *= strength;
return normalize(corrected) * 0.5 + 0.5;
}
vec3 apply_mask_height_effect(vec3 original_normal, float mask, float height, float strength) {
if (height == 0.0) return original_normal;
vec3 n = original_normal * 2.0 - 1.0;
float offset_z = (mask - 0.5) * height;
vec3 new_normal = vec3(n.xy * (1.0 - abs(offset_z) * 0.5), n.z + offset_z);
return normalize(new_normal) * 0.5 + 0.5;
}
float large_scale_noise(vec3 pos, float scale, float contrast, float brightness, float smoothness, int octaves) {
float x = pos.x * scale;
float y = pos.y * scale * 1.73205080757;
float z = pos.z * scale * 1.41421356237;
float noise = 0.0;
float total_weight = 0.0;
float base = sin(x * 0.5) * cos(y * 0.5) + sin(y * 0.5) * cos(z * 0.5) + sin(z * 0.5) * cos(x * 0.5);
base = base * 0.5 + 0.5;
noise += base * 0.7;
total_weight += 0.7;
if (octaves >= 2) {
float octave2 = sin(x * 1.0) * cos(y * 1.0) + sin(y * 1.0) * cos(z * 1.0) + sin(z * 1.0) * cos(x * 1.0);
octave2 = octave2 * 0.5 + 0.5;
noise += octave2 * 0.35;
total_weight += 0.35;
}
if (octaves >= 3) {
float octave3 = sin(x * 2.0) * cos(y * 2.0) + sin(y * 2.0) * cos(z * 2.0) + sin(z * 2.0) * cos(x * 2.0);
octave3 = octave3 * 0.5 + 0.5;
noise += octave3 * 0.175;
total_weight += 0.175;
}
if (octaves >= 4) {
float octave4 = sin(x * 4.0) * cos(y * 4.0) + sin(y * 4.0) * cos(z * 4.0) + sin(z * 4.0) * cos(x * 4.0);
octave4 = octave4 * 0.5 + 0.5;
noise += octave4 * 0.0875;
total_weight += 0.0875;
}
if (octaves >= 5) {
float octave5 = sin(x * 8.0) * cos(y * 8.0) + sin(y * 8.0) * cos(z * 8.0) + sin(z * 8.0) * cos(x * 8.0);
octave5 = octave5 * 0.5 + 0.5;
noise += octave5 * 0.04375;
total_weight += 0.04375;
}
noise = noise / total_weight;
noise = clamp(noise, 0.0, 1.0);
noise = clamp((noise - 0.5) * contrast + 0.5 + brightness, 0.0, 1.0);
if (smoothness > 0.0) {
noise = smoothstep(smoothness, 1.0 - smoothness, noise);
}
return noise;
}
vec4 triplanar_texture(sampler2D p_sampler, vec3 p_weights, vec3 p_triplanar_pos) {
vec4 samp = vec4(0.0);
samp += texture(p_sampler, p_triplanar_pos.xy) * p_weights.z;
samp += texture(p_sampler, p_triplanar_pos.xz) * p_weights.y;
samp += texture(p_sampler, p_triplanar_pos.zy * vec2(-1.0, 1.0)) * p_weights.x;
return samp;
}
bool is_selected_face(vec3 normal, int face) {
switch(face) {
case 1: return normal.x > 0.9;
case 2: return normal.x < -0.9;
case 3: return normal.y > 0.9;
case 4: return normal.y < -0.9;
case 5: return normal.z > 0.9;
case 6: return normal.z < -0.9;
default: return false;
}
}
// ==================== BLENDING FUNCTIONS ====================
vec3 BlendedAlbedo(vec4 albedo_t, vec4 detail_t, vec4 detail_mask_t, int blend_mode) {
float mask = detail_mask_t.r;
if (mask < 0.001) return albedo_t.rgb;
vec3 blended;
switch(blend_mode) {
case 1: blended = mix(albedo_t.rgb, detail_t.rgb, mask); break;
case 2: blended = albedo_t.rgb + detail_t.rgb * mask; break;
case 3: blended = albedo_t.rgb - detail_t.rgb * mask; break;
case 4:
blended = albedo_t.rgb * detail_t.rgb;
blended = mix(albedo_t.rgb, blended, mask);
break;
default: blended = albedo_t.rgb;
};
return blended;
}
vec3 BlendedNormal(vec3 normal_m, vec4 detail_norm_t, vec4 detail_mask_t, int blend_mode) {
float mask = detail_mask_t.r;
if (mask < 0.001) return normal_m;
vec3 blended;
vec3 detail_normal = detail_norm_t.rgb * 2.0 - 1.0;
switch(blend_mode) {
case 1: blended = mix(normal_m, detail_normal, mask); break;
case 2: blended = normal_m + detail_normal * mask; break;
case 3: blended = normal_m - detail_normal * mask; break;
case 4:
blended = normal_m * detail_normal;
blended = mix(normal_m, blended, mask);
break;
default: blended = normal_m;
};
return normalize(blended) * 0.5 + 0.5;
}
float BlendedMetallic(float metallic_base, vec4 detail_metallic_t, float mask, int blend_mode) {
if (mask < 0.001) return metallic_base;
float detail_metallic = detail_metallic_t.r;
float blended;
switch(blend_mode) {
case 1: blended = mix(metallic_base, detail_metallic, mask); break;
case 2: blended = metallic_base + detail_metallic * mask; break;
case 3: blended = metallic_base - detail_metallic * mask; break;
case 4:
blended = metallic_base * detail_metallic;
blended = mix(metallic_base, blended, mask);
break;
default: blended = metallic_base;
};
return clamp(blended, 0.0, 1.0);
}
float BlendedRoughness(float roughness_base, vec4 detail_roughness_t, float mask, int blend_mode) {
if (mask < 0.001) return roughness_base;
float detail_roughness = detail_roughness_t.r;
float blended;
switch(blend_mode) {
case 1: blended = mix(roughness_base, detail_roughness, mask); break;
case 2: blended = roughness_base + detail_roughness * mask; break;
case 3: blended = roughness_base - detail_roughness * mask; break;
case 4:
blended = roughness_base * detail_roughness;
blended = mix(roughness_base, blended, mask);
break;
default: blended = roughness_base;
};
return clamp(blended, 0.0, 1.0);
}
// ==================== VERTEX SHADER ====================
void vertex() {
vec3 normal = normalize(MODEL_NORMAL_MATRIX * NORMAL);
world_normal = normalize((MODEL_MATRIX * vec4(NORMAL, 0.0)).xyz);
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 = inverse(MODEL_NORMAL_MATRIX) * 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 = inverse(MODEL_NORMAL_MATRIX) * normalize(BINORMAL);
uv1_power_normal = pow(abs(normal), vec3(uv1_blend_sharpness));
uv1_power_normal /= dot(uv1_power_normal, vec3(1.0));
uv1_triplanar_pos = (MODEL_MATRIX * vec4(VERTEX, 1.0)).xyz * uv1_scale + uv1_offset;
uv1_triplanar_pos *= vec3(1.0, -1.0, 1.0);
uv1_triplanar_pos_blend = (MODEL_MATRIX * vec4(VERTEX, 1.0)).xyz;
}
// ==================== FRAGMENT SHADER ====================
void fragment() {
bool is_inner = is_selected_face(world_normal, inner_face);
vec4 albedo_tex;
float metallic_tex;
float roughness_tex;
vec3 normal_map;
float ao_tex;
vec4 detail_tex;
vec4 detail_norm_tex;
vec4 detail_mask_tex;
vec4 detail_metallic_tex;
vec4 detail_roughness_tex;
vec3 blend_triplanar_pos;
if (is_inner) {
// ========== INSIDE TEXTURES ==========
// Albedo
albedo_tex = triplanar_texture(texture_albedo_inner, uv1_power_normal, uv1_triplanar_pos) * albedo_inner;
albedo_tex.rgb = apply_color_correction(albedo_tex.rgb, albedo_inner_brightness, albedo_inner_contrast, albedo_inner_saturation);
// Metallic
metallic_tex = triplanar_texture(texture_metallic_inner, uv1_power_normal, uv1_triplanar_pos).r * metallic_inner;
metallic_tex = apply_contrast_brightness(metallic_tex, metallic_inner_brightness, metallic_inner_contrast);
// Roughness
roughness_tex = triplanar_texture(texture_roughness_inner, uv1_power_normal, uv1_triplanar_pos).r * roughness_inner;
roughness_tex = apply_contrast_brightness(roughness_tex, roughness_inner_brightness, roughness_inner_contrast);
// Normal
normal_map = triplanar_texture(texture_normal_inner, uv1_power_normal, uv1_triplanar_pos).rgb;
normal_map = apply_normal_correction(normal_map, normal_inner_strength);
// Ambient Occlusion
ao_tex = triplanar_texture(texture_ambient_occlusion_inner, uv1_power_normal, uv1_triplanar_pos).r;
ao_tex = apply_contrast_brightness(ao_tex, ao_inner_brightness, ao_inner_contrast);
// ========== INSIDE BLEND ==========
if (Blend_inner) {
blend_triplanar_pos = uv1_triplanar_pos_blend * uv1_scale_blend_inner + uv1_offset_blend_inner;
blend_triplanar_pos *= vec3(1.0, -1.0, 1.0);
// Detail Albedo
detail_tex = triplanar_texture(texture_detail_albedo_inner, uv1_power_normal, blend_triplanar_pos);
detail_tex.rgb = apply_color_correction(detail_tex.rgb, detail_albedo_inner_brightness, detail_albedo_inner_contrast, detail_albedo_inner_saturation);
// Detail Normal
detail_norm_tex = triplanar_texture(texture_detail_normal_inner, uv1_power_normal, blend_triplanar_pos);
detail_norm_tex.rgb = apply_normal_correction(detail_norm_tex.rgb, detail_normal_inner_strength);
// Detail Metallic
detail_metallic_tex = triplanar_texture(texture_detail_metallic_inner, uv1_power_normal, blend_triplanar_pos);
detail_metallic_tex.r = apply_contrast_brightness(detail_metallic_tex.r, detail_metallic_inner_brightness, detail_metallic_inner_contrast);
// Detail Roughness
detail_roughness_tex = triplanar_texture(texture_detail_roughness_inner, uv1_power_normal, blend_triplanar_pos);
detail_roughness_tex.r = apply_contrast_brightness(detail_roughness_tex.r, detail_roughness_inner_brightness, detail_roughness_inner_contrast);
// Mask
if (use_noise_mask_inner) {
float noise_value = large_scale_noise(
uv1_triplanar_pos_blend,
noise_scale_inner,
noise_contrast_inner,
noise_brightness_inner,
noise_smoothness_inner,
noise_octaves_inner
);
detail_mask_tex = vec4(noise_value);
} else {
vec3 mask_triplanar_pos = uv1_triplanar_pos_blend;
mask_triplanar_pos *= vec3(1.0, -1.0, 1.0);
detail_mask_tex = triplanar_texture(texture_detail_mask_inner, uv1_power_normal, mask_triplanar_pos);
}
float mask = detail_mask_tex.r;
albedo_tex.rgb = BlendedAlbedo(albedo_tex, detail_tex, detail_mask_tex, Blend_Mode_inner);
normal_map = BlendedNormal(normal_map, detail_norm_tex, detail_mask_tex, Blend_Mode_inner);
metallic_tex = BlendedMetallic(metallic_tex, detail_metallic_tex, mask, Blend_Mode_inner);
roughness_tex = BlendedRoughness(roughness_tex, detail_roughness_tex, mask, Blend_Mode_inner);
if (mask_height_inner != 0.0) {
normal_map = apply_mask_height_effect(normal_map, mask, mask_height_inner, 1.0);
}
}
} else {
// ========== OUTSIDE TEXTURES ==========
// Albedo
albedo_tex = triplanar_texture(texture_albedo_out, uv1_power_normal, uv1_triplanar_pos) * albedo_out;
albedo_tex.rgb = apply_color_correction(albedo_tex.rgb, albedo_out_brightness, albedo_out_contrast, albedo_out_saturation);
// Metallic
metallic_tex = triplanar_texture(texture_metallic_out, uv1_power_normal, uv1_triplanar_pos).r * metallic_out;
metallic_tex = apply_contrast_brightness(metallic_tex, metallic_out_brightness, metallic_out_contrast);
// Roughness
roughness_tex = triplanar_texture(texture_roughness_out, uv1_power_normal, uv1_triplanar_pos).r * roughness_out;
roughness_tex = apply_contrast_brightness(roughness_tex, roughness_out_brightness, roughness_out_contrast);
// Normal
normal_map = triplanar_texture(texture_normal_out, uv1_power_normal, uv1_triplanar_pos).rgb;
normal_map = apply_normal_correction(normal_map, normal_out_strength);
// Ambient Occlusion
ao_tex = triplanar_texture(texture_ambient_occlusion_out, uv1_power_normal, uv1_triplanar_pos).r;
ao_tex = apply_contrast_brightness(ao_tex, ao_out_brightness, ao_out_contrast);
// ========== OUTSIDE BLEND ==========
if (Blend_out) {
blend_triplanar_pos = uv1_triplanar_pos_blend * uv1_scale_blend_out + uv1_offset_blend_out;
blend_triplanar_pos *= vec3(1.0, -1.0, 1.0);
// Detail Albedo
detail_tex = triplanar_texture(texture_detail_albedo_out, uv1_power_normal, blend_triplanar_pos);
detail_tex.rgb = apply_color_correction(detail_tex.rgb, detail_albedo_out_brightness, detail_albedo_out_contrast, detail_albedo_out_saturation);
// Detail Normal
detail_norm_tex = triplanar_texture(texture_detail_normal_out, uv1_power_normal, blend_triplanar_pos);
detail_norm_tex.rgb = apply_normal_correction(detail_norm_tex.rgb, detail_normal_out_strength);
// Detail Metallic
detail_metallic_tex = triplanar_texture(texture_detail_metallic_out, uv1_power_normal, blend_triplanar_pos);
detail_metallic_tex.r = apply_contrast_brightness(detail_metallic_tex.r, detail_metallic_out_brightness, detail_metallic_out_contrast);
// Detail Roughness
detail_roughness_tex = triplanar_texture(texture_detail_roughness_out, uv1_power_normal, blend_triplanar_pos);
detail_roughness_tex.r = apply_contrast_brightness(detail_roughness_tex.r, detail_roughness_out_brightness, detail_roughness_out_contrast);
// Mask
if (use_noise_mask_out) {
float noise_value = large_scale_noise(
uv1_triplanar_pos_blend,
noise_scale_out,
noise_contrast_out,
noise_brightness_out,
noise_smoothness_out,
noise_octaves_out
);
detail_mask_tex = vec4(noise_value);
} else {
vec3 mask_triplanar_pos = uv1_triplanar_pos_blend;
mask_triplanar_pos *= vec3(1.0, -1.0, 1.0);
detail_mask_tex = triplanar_texture(texture_detail_mask_out, uv1_power_normal, mask_triplanar_pos);
}
float mask = detail_mask_tex.r;
albedo_tex.rgb = BlendedAlbedo(albedo_tex, detail_tex, detail_mask_tex, Blend_Mode_out);
normal_map = BlendedNormal(normal_map, detail_norm_tex, detail_mask_tex, Blend_Mode_out);
metallic_tex = BlendedMetallic(metallic_tex, detail_metallic_tex, mask, Blend_Mode_out);
roughness_tex = BlendedRoughness(roughness_tex, detail_roughness_tex, mask, Blend_Mode_out);
if (mask_height_out != 0.0) {
normal_map = apply_mask_height_effect(normal_map, mask, mask_height_out, 1.0);
}
}
}
ALBEDO = albedo_tex.rgb;
METALLIC = metallic_tex;
SPECULAR = specular;
ROUGHNESS = roughness_tex;
NORMAL_MAP = normal_map;
NORMAL_MAP_DEPTH = normal_scale;
AO = ao_tex;
AO_LIGHT_AFFECT = ao_light_affect;
}Join the discussion! Log in to share your thoughts.
Log In to Comment