Skip to content

Commit

Permalink
Merge pull request #1971 from Autodesk/krickw/MAYA-120864/change_prim…
Browse files Browse the repository at this point in the history
…var_reader_type_before_adding_type_conversion_fragments

MAYA-120864 Changing the primvar reader to a color reader can change the output
  • Loading branch information
seando-adsk authored Jan 11, 2022
2 parents e57a53e + d049280 commit 0db0915
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/mayaUsd/render/vp2RenderDelegate/material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1661,15 +1661,17 @@ void HdVP2Material::_ApplyVP2Fixes(HdMaterialNetwork& outNet, const HdMaterialNe

addPredecessorNodes(node);
outNet.nodes.push_back(node);
addSuccessorNodes(node, primvarToRead);

// If the primvar reader is reading color or opacity, replace it with
// UsdPrimvarReader_color which can create COLOR stream requirement
// instead of generic TEXCOORD stream.
// Do this before addSuccessorNodes, because changing the identifier may change the
// input/output types and require another conversion node.
if (primvarToRead == HdTokens->displayColor || primvarToRead == HdTokens->displayOpacity) {
HdMaterialNode& nodeToChange = outNet.nodes.back();
nodeToChange.identifier = _tokens->UsdPrimvarReader_color;
}
addSuccessorNodes(node, primvarToRead);

// Normal map is not supported yet. For now primvars:normals is used for
// shading, which is also the current behavior of USD/Hydra.
Expand All @@ -1678,7 +1680,7 @@ void HdVP2Material::_ApplyVP2Fixes(HdMaterialNetwork& outNet, const HdMaterialNe
// UsdImagingMaterialAdapter doesn't create primvar requirements as
// expected. Workaround by manually looking up "varname" parameter.
// https://groups.google.com/forum/#!msg/usd-interest/z-14AgJKOcU/1uJJ1thXBgAJ
else if (isUsdPrimvarReader) {
if (isUsdPrimvarReader) {
if (!primvarToRead.IsEmpty()) {
outNet.primvars.push_back(primvarToRead);
}
Expand Down

0 comments on commit 0db0915

Please sign in to comment.