Skip to content

Commit 1cc4e18

Browse files
authored
Add bitangent input check to normalmap upgrade (#2248)
This PR adds a check to the normalmap upgrade function to make sure that we don't try to add a bitangent input if one is already set.
1 parent faa8d79 commit 1cc4e18

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

source/MaterialXCore/Version.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1324,10 +1324,12 @@ void Document::upgradeVersion()
13241324

13251325
node->removeInput("space");
13261326

1327-
// If the normal or tangent inputs are set, the bitangent input should be normalize(cross(N, T))
1327+
// If the normal or tangent inputs are set and the bitangent input is not,
1328+
// the bitangent should be set to normalize(cross(N, T))
13281329
InputPtr normalInput = node->getInput("normal");
13291330
InputPtr tangentInput = node->getInput("tangent");
1330-
if (normalInput || tangentInput)
1331+
InputPtr bitangentInput = node->getInput("bitangent");
1332+
if ((normalInput || tangentInput) && !bitangentInput)
13311333
{
13321334
GraphElementPtr graph = node->getAncestorOfType<GraphElement>();
13331335
NodePtr crossNode = graph->addNode("crossproduct", graph->createValidChildName("normalmap_cross"), "vector3");

0 commit comments

Comments
 (0)