diff --git a/assets/scripts/shader_data/materials/eye_legacy.udm b/assets/scripts/shader_data/materials/eye_legacy.udm index 848fea62b..ea87e3783 100644 --- a/assets/scripts/shader_data/materials/eye_legacy.udm +++ b/assets/scripts/shader_data/materials/eye_legacy.udm @@ -21,7 +21,7 @@ }, { $string name "emission_map" - $string default "white" + $string default "black" } ] } diff --git a/assets/scripts/shader_data/materials/pbr.udm b/assets/scripts/shader_data/materials/pbr.udm index 530be2ea2..b89fca080 100644 --- a/assets/scripts/shader_data/materials/pbr.udm +++ b/assets/scripts/shader_data/materials/pbr.udm @@ -64,7 +64,7 @@ }, { $string name "emission_map" - $string default "white" + $string default "black" $string specializationType "emission" }, { diff --git a/core/client/src/rendering/shaders/world/c_shader_textured.cpp b/core/client/src/rendering/shaders/world/c_shader_textured.cpp index f461ff076..8c2d49be5 100644 --- a/core/client/src/rendering/shaders/world/c_shader_textured.cpp +++ b/core/client/src/rendering/shaders/world/c_shader_textured.cpp @@ -425,8 +425,18 @@ std::shared_ptr ShaderGameWorldLightingPass::Initi materialFlags |= pragma::rendering::shader_material::MaterialFlags::HasParallaxMap; break; case "emission_map"_: - materialFlags |= pragma::rendering::shader_material::MaterialFlags::HasEmissionMap; - break; + { + materialFlags |= pragma::rendering::shader_material::MaterialFlags::HasEmissionMap; + auto path = pragma::asset::get_normalized_path(texData->GetName(), pragma::asset::Type::Texture); + static const auto emissionNeutralMap = pragma::asset::get_normalized_path("black", pragma::asset::Type::Texture); + if(path == emissionNeutralMap) { + // If the material uses the neutral emission texture, we can completely ignore + // it for the shader and use the default values instead, which saves + // a lot of texture lookups. + materialFlags &= ~pragma::rendering::shader_material::MaterialFlags::HasEmissionMap; + } + break; + } case "rma_map"_: { materialFlags |= pragma::rendering::shader_material::MaterialFlags::HasRmaMap;