mirror of
https://github.com/MaSzyna-EU07/maszyna.git
synced 2026-07-22 22:09:19 +02:00
Zamiana metalic na floata z wazonym efektem.
This commit is contained in:
@@ -8,7 +8,7 @@ uniform sampler2D headlightmap;
|
|||||||
#include <conversion.glsl>
|
#include <conversion.glsl>
|
||||||
|
|
||||||
float glossiness = 1.0;
|
float glossiness = 1.0;
|
||||||
bool metalic = false;
|
float metalic = 0.0;
|
||||||
|
|
||||||
float length2(vec3 v)
|
float length2(vec3 v)
|
||||||
{
|
{
|
||||||
@@ -167,16 +167,11 @@ vec3 apply_lights(vec3 fragcolor, vec3 fragnormal, vec3 texturecolor, float refl
|
|||||||
fragcolor += emissioncolor;
|
fragcolor += emissioncolor;
|
||||||
vec3 specularcolor = specularamount * lights[0].color;
|
vec3 specularcolor = specularamount * lights[0].color;
|
||||||
|
|
||||||
if ((param[1].w < 0.0) || (metalic == true))
|
if (param[1].w < 0.0)
|
||||||
{
|
{
|
||||||
fragcolor += specularcolor;
|
float metalic = 1.0;
|
||||||
fragcolor *= texturecolor;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
fragcolor *= texturecolor;
|
|
||||||
fragcolor += specularcolor;
|
|
||||||
}
|
}
|
||||||
|
fragcolor = mix(((fragcolor + specularcolor) * texturecolor),(fragcolor * texturecolor + specularcolor),metalic) ;
|
||||||
|
|
||||||
return fragcolor;
|
return fragcolor;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ void main()
|
|||||||
float reflectivity = param[1].z;
|
float reflectivity = param[1].z;
|
||||||
float specularity = texture(specgloss, f_coord).r;
|
float specularity = texture(specgloss, f_coord).r;
|
||||||
glossiness = texture(specgloss, f_coord).g * abs(param[1].w);
|
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);
|
fragcolor = apply_lights(fragcolor, fragnormal, tex_color.rgb, reflectivity, specularity, shadow_tone);
|
||||||
vec4 color = vec4(apply_fog(fragcolor), tex_color.a * alpha_mult);
|
vec4 color = vec4(apply_fog(fragcolor), tex_color.a * alpha_mult);
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ void main()
|
|||||||
float reflectivity = param[1].z * texture(normalmap, f_coord).a;
|
float reflectivity = param[1].z * texture(normalmap, f_coord).a;
|
||||||
float specularity = texture(specgloss, f_coord).r;
|
float specularity = texture(specgloss, f_coord).r;
|
||||||
glossiness = texture(specgloss, f_coord).g * abs(param[1].w);
|
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);
|
fragcolor = apply_lights(fragcolor, fragnormal, tex_color.rgb, reflectivity, specularity, shadow_tone);
|
||||||
|
|
||||||
|
|||||||
@@ -59,9 +59,9 @@ void main()
|
|||||||
normal.z = sqrt(1.0 - clamp((dot(normal.xy, normal.xy)), 0.0, 1.0));
|
normal.z = sqrt(1.0 - clamp((dot(normal.xy, normal.xy)), 0.0, 1.0));
|
||||||
vec3 fragnormal = normalize(f_tbn * normalize(normal.xyz));
|
vec3 fragnormal = normalize(f_tbn * normalize(normal.xyz));
|
||||||
float reflectivity = param[1].z * texture(normalmap, f_coord_p).a;
|
float reflectivity = param[1].z * texture(normalmap, f_coord_p).a;
|
||||||
float specularity = texture(specgloss, f_coord).r;
|
float specularity = texture(specgloss, f_coord_p).r;
|
||||||
glossiness = texture(specgloss, f_coord).g * abs(param[1].w);
|
glossiness = texture(specgloss, f_coord_p).g * abs(param[1].w);
|
||||||
metalic = (texture(specgloss, f_coord).b > 0.5) ? true : false;
|
float metalic = texture(specgloss, f_coord_p).b;
|
||||||
|
|
||||||
fragcolor = apply_lights(fragcolor, fragnormal, tex_color.rgb, reflectivity, specularity, shadow_tone);
|
fragcolor = apply_lights(fragcolor, fragnormal, tex_color.rgb, reflectivity, specularity, shadow_tone);
|
||||||
|
|
||||||
|
|||||||
@@ -47,7 +47,7 @@ void main()
|
|||||||
float reflectivity = param[1].z * texture(reflmap, f_coord).a;
|
float reflectivity = param[1].z * texture(reflmap, f_coord).a;
|
||||||
float specularity = texture(specgloss, f_coord).r;
|
float specularity = texture(specgloss, f_coord).r;
|
||||||
glossiness = texture(specgloss, f_coord).g * abs(param[1].w);
|
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);
|
fragcolor = apply_lights(fragcolor, fragnormal, tex_color.rgb, reflectivity, specularity, shadow_tone);
|
||||||
|
|
||||||
|
|||||||
@@ -53,7 +53,7 @@ void main()
|
|||||||
float reflectivity = param[1].z * texture(normalmap, f_coord).a;
|
float reflectivity = param[1].z * texture(normalmap, f_coord).a;
|
||||||
float specularity = texture(specgloss, f_coord).r;
|
float specularity = texture(specgloss, f_coord).r;
|
||||||
glossiness = texture(specgloss, f_coord).g * abs(param[1].w);
|
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);
|
fragcolor = apply_lights(fragcolor, fragnormal, tex_color.rgb, reflectivity, specularity, 1.0);
|
||||||
vec4 color = vec4(apply_fog(fragcolor), tex_color.a * alpha_mult);
|
vec4 color = vec4(apply_fog(fragcolor), tex_color.a * alpha_mult);
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ void main()
|
|||||||
float reflectivity = param[1].z * texture(normalmap, f_coord).a;
|
float reflectivity = param[1].z * texture(normalmap, f_coord).a;
|
||||||
float specularity = texture(specgloss, f_coord).r;
|
float specularity = texture(specgloss, f_coord).r;
|
||||||
glossiness = texture(specgloss, f_coord).g * abs(param[1].w);
|
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);
|
fragcolor = apply_lights_sunless(fragcolor, fragnormal, tex_color.rgb, reflectivity, specularity, shadow_tone);
|
||||||
vec4 color = vec4(apply_fog(fragcolor), tex_color.a * alpha_mult);
|
vec4 color = vec4(apply_fog(fragcolor), tex_color.a * alpha_mult);
|
||||||
|
|||||||
@@ -64,7 +64,7 @@ void main()
|
|||||||
float reflectivity = param[1].z * texture(normalmap, texture_coords ).a;
|
float reflectivity = param[1].z * texture(normalmap, texture_coords ).a;
|
||||||
float specularity = texture(specgloss, f_coord).r;
|
float specularity = texture(specgloss, f_coord).r;
|
||||||
glossiness = texture(specgloss, f_coord).g * abs(param[1].w);
|
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);
|
fragcolor = apply_lights(fragcolor, fragnormal, tex_color.rgb, reflectivity, specularity, shadow_tone);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user