16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-21 04:39:18 +02:00

Zamiana metalic na floata z wazonym efektem.

This commit is contained in:
stele
2020-10-24 19:14:45 +02:00
parent 4b38395cb6
commit 75cadb0079
8 changed files with 15 additions and 20 deletions

View File

@@ -8,7 +8,7 @@ uniform sampler2D headlightmap;
#include <conversion.glsl>
float glossiness = 1.0;
bool metalic = false;
float metalic = 0.0;
float length2(vec3 v)
{
@@ -167,16 +167,11 @@ vec3 apply_lights(vec3 fragcolor, vec3 fragnormal, vec3 texturecolor, float refl
fragcolor += emissioncolor;
vec3 specularcolor = specularamount * lights[0].color;
if ((param[1].w < 0.0) || (metalic == true))
{
fragcolor += specularcolor;
fragcolor *= texturecolor;
}
else
{
fragcolor *= texturecolor;
fragcolor += specularcolor;
}
if (param[1].w < 0.0)
{
float metalic = 1.0;
}
fragcolor = mix(((fragcolor + specularcolor) * texturecolor),(fragcolor * texturecolor + specularcolor),metalic) ;
return fragcolor;
}

View File

@@ -43,7 +43,7 @@ void main()
float reflectivity = param[1].z;
float specularity = texture(specgloss, f_coord).r;
glossiness = texture(specgloss, f_coord).g * abs(param[1].w);
metalic = (texture(specgloss, f_coord).b > 0.5) ? true : false;
float metalic = texture(specgloss, f_coord).b;
fragcolor = apply_lights(fragcolor, fragnormal, tex_color.rgb, reflectivity, specularity, shadow_tone);
vec4 color = vec4(apply_fog(fragcolor), tex_color.a * alpha_mult);

View File

@@ -53,7 +53,7 @@ void main()
float reflectivity = param[1].z * texture(normalmap, f_coord).a;
float specularity = texture(specgloss, f_coord).r;
glossiness = texture(specgloss, f_coord).g * abs(param[1].w);
metalic = (texture(specgloss, f_coord).b > 0.5) ? true : false;
float metalic = texture(specgloss, f_coord).b;
fragcolor = apply_lights(fragcolor, fragnormal, tex_color.rgb, reflectivity, specularity, shadow_tone);

View File

@@ -59,9 +59,9 @@ void main()
normal.z = sqrt(1.0 - clamp((dot(normal.xy, normal.xy)), 0.0, 1.0));
vec3 fragnormal = normalize(f_tbn * normalize(normal.xyz));
float reflectivity = param[1].z * texture(normalmap, f_coord_p).a;
float specularity = texture(specgloss, f_coord).r;
glossiness = texture(specgloss, f_coord).g * abs(param[1].w);
metalic = (texture(specgloss, f_coord).b > 0.5) ? true : false;
float specularity = texture(specgloss, f_coord_p).r;
glossiness = texture(specgloss, f_coord_p).g * abs(param[1].w);
float metalic = texture(specgloss, f_coord_p).b;
fragcolor = apply_lights(fragcolor, fragnormal, tex_color.rgb, reflectivity, specularity, shadow_tone);

View File

@@ -47,7 +47,7 @@ void main()
float reflectivity = param[1].z * texture(reflmap, f_coord).a;
float specularity = texture(specgloss, f_coord).r;
glossiness = texture(specgloss, f_coord).g * abs(param[1].w);
metalic = (texture(specgloss, f_coord).b > 0.5) ? true : false;
float metalic = texture(specgloss, f_coord).b;
fragcolor = apply_lights(fragcolor, fragnormal, tex_color.rgb, reflectivity, specularity, shadow_tone);

View File

@@ -53,7 +53,7 @@ void main()
float reflectivity = param[1].z * texture(normalmap, f_coord).a;
float specularity = texture(specgloss, f_coord).r;
glossiness = texture(specgloss, f_coord).g * abs(param[1].w);
metalic = (texture(specgloss, f_coord).b > 0.5) ? true : false;
float metalic = texture(specgloss, f_coord).b;
fragcolor = apply_lights(fragcolor, fragnormal, tex_color.rgb, reflectivity, specularity, 1.0);
vec4 color = vec4(apply_fog(fragcolor), tex_color.a * alpha_mult);

View File

@@ -110,7 +110,7 @@ void main()
float reflectivity = param[1].z * texture(normalmap, f_coord).a;
float specularity = texture(specgloss, f_coord).r;
glossiness = texture(specgloss, f_coord).g * abs(param[1].w);
metalic = (texture(specgloss, f_coord).b > 0.5) ? true : false;
float metalic = texture(specgloss, f_coord).b;
fragcolor = apply_lights_sunless(fragcolor, fragnormal, tex_color.rgb, reflectivity, specularity, shadow_tone);
vec4 color = vec4(apply_fog(fragcolor), tex_color.a * alpha_mult);

View File

@@ -64,7 +64,7 @@ void main()
float reflectivity = param[1].z * texture(normalmap, texture_coords ).a;
float specularity = texture(specgloss, f_coord).r;
glossiness = texture(specgloss, f_coord).g * abs(param[1].w);
metalic = (texture(specgloss, f_coord).b > 0.5) ? true : false;
float metalic = texture(specgloss, f_coord).b;
fragcolor = apply_lights(fragcolor, fragnormal, tex_color.rgb, reflectivity, specularity, shadow_tone);