     }
   }
   out_color.rgb = (direct + ambient) + emission;
-  out_color.a = clamp(material.alpha * (albedo_from_map.a + float(!has_albedo_map)), 0.0, 1.0);
+  out_color.a = clamp(albedo_alpha.a, 0.0, 1.0);
 
   //Fog
   float fog_distance = distance(fragment.position, camera.position);

  return out_normal;
}


void main() {
  vec3 N = sample_normal(fragment.normal, material.normal_sampler, fragment.tbn, fragment.uv);

  bool has_albedo_map = textureSize(material.albedo_sampler, 0).x != 1;
  vec4 albedo_from_map = texture(material.albedo_sampler, fragment.uv);
  vec3 albedo = has_albedo_map ? albedo_from_map.rgb : material.albedo.rgb;

  vec4 emission_from_map = texture(material.emission_sampler, fragment.uv);
  vec3 emission = mix(material.emission.rgb, emission_from_map.rgb, emission_from_map.a);


      vec3 irradiance = sample_environment(environment_samplers[i], corrected_N, num_levels - 1.5, 0.5, 1.0);

      const vec3 diffuse_environment = irradiance * albedo_alpha.rgb * environments[i].strength;

      attenuation = (attenuation == 0.0) ? environment_attenuation(fragment.position, environments[i].position, environments[i].extent, environments[i].falloff) : 1.0 - attenuation;

