17
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-10-17 01:39:20 +02:00

fix(shaders): a surface marked as metal in specgloss but with an albedo darker than any real metal is lit as the painted or dirty dielectric it stands for, with its diffuse back and its highlight held to 0.06, instead of going black without a diffuse term, and a metal reflects its surroundings at least at half strength whatever the alpha of its normal map says, since its reflection is all of its colour; materials without specgloss stay as they were

This commit is contained in:
maj00r
2026-10-14 22:09:13 +02:00
parent 8df87d42cf
commit 101ab5be5f

View File

@@ -375,6 +375,11 @@ vec3 apply_lights(vec3 fragcolor, vec3 fragnormal, vec3 texturecolor, float refl
fragcolor *= pow(gtao.x, gtao_params.y) * min((0.75 + 0.25 * gtao_bent.y) / (0.75 + 0.25 * gtao_normal.y), 1.0);
#endif
float metal_dark = metalic * (1.0 - smoothstep(0.02, 0.2, dot(texturecolor, vec3(0.2126, 0.7152, 0.0722))));
metalic -= metal_dark;
specularity = mix(specularity, min(specularity, 0.06), metal_dark);
reflectivity = max(reflectivity, 0.5 * metalic);
vec3 emissioncolor = vec3(emission);
vec3 view_dir = normalize(-f_pos.xyz);