Fix #114377: Workbench: Support None and Channel Packed alpha modes

This commit is contained in:
Miguel Pozo
2023-11-07 15:51:45 +01:00
parent b4316445a8
commit d64e9759ef

View File

@@ -91,7 +91,11 @@ PassMain::Sub &MeshPass::get_subpass(
/* TODO(@pragma37): This setting should be exposed on the user side,
* either as a global parameter (and set it here)
* or by reading the Material Clipping Threshold (and set it per material) */
sub_pass->push_constant("imageTransparencyCutoff", 0.1f);
float alpha_cutoff = 0.1f;
if (ELEM(image->alpha_mode, IMA_ALPHA_IGNORE, IMA_ALPHA_CHANNEL_PACKED)) {
alpha_cutoff = -FLT_MAX;
}
sub_pass->push_constant("imageTransparencyCutoff", alpha_cutoff);
return sub_pass;
};