Skip to content

Commit

Permalink
fix: materials without emission being emissive
Browse files Browse the repository at this point in the history
  • Loading branch information
Silverlan committed Dec 18, 2024
1 parent 2e621c0 commit f98bdab
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion assets/scripts/shader_data/materials/eye_legacy.udm
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
},
{
$string name "emission_map"
$string default "white"
$string default "black"
}
]
}
2 changes: 1 addition & 1 deletion assets/scripts/shader_data/materials/pbr.udm
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
},
{
$string name "emission_map"
$string default "white"
$string default "black"
$string specializationType "emission"
},
{
Expand Down
14 changes: 12 additions & 2 deletions core/client/src/rendering/shaders/world/c_shader_textured.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -425,8 +425,18 @@ std::shared_ptr<prosper::IDescriptorSetGroup> 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;
Expand Down

0 comments on commit f98bdab

Please sign in to comment.