Fix #124073: Incorrect material shadow mode versioning

Only apply EEVEE-Next material shadow versioning to materials with
surfaces. Otherwise this will break the rendering of some materials
(E.g. Volumetrics) by making the surface opaque to the camera.

Pull Request: https://projects.blender.org/blender/blender/pulls/124076
This commit is contained in:
Alaska 2024-07-03 14:23:40 +02:00 committed by Clément Foucault
parent 74c09b2e63
commit 1e6161759e

@ -358,6 +358,12 @@ static void versioning_eevee_material_shadow_none(Material *material)
}
bNodeSocket *out_sock = blender::bke::nodeFindSocket(output_node, SOCK_IN, "Surface");
bNodeSocket *volume_sock = blender::bke::nodeFindSocket(output_node, SOCK_IN, "Volume");
if (out_sock->link == nullptr && volume_sock->link) {
/* Don't apply versioning to a material that only has a volumetric input as this makes the
* object surface opaque to the camera, hiding the volume inside. */
return;
}
bNode *mix_node = blender::bke::nodeAddNode(nullptr, ntree, "ShaderNodeMixShader");
STRNCPY(mix_node->label, "Disable Shadow");