Skip to content

Commit

Permalink
Fixing a crash related to the new requirement of MaterialX to support…
Browse files Browse the repository at this point in the history
… tangetnt buffer.
  • Loading branch information
vlasovi committed Mar 15, 2022
1 parent 9d4021c commit fdcfcff
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions lib/mayaUsd/render/vp2RenderDelegate/points.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ TF_DEFINE_PRIVATE_TOKENS(
_tokens,

(spriteWidth)
(tangents)
);
// clang-format on

Expand Down Expand Up @@ -327,6 +328,20 @@ void HdVP2Points::_UpdateDrawItem(
_CommitMVertexBuffer(_pointsSharedData._normalsBuffer.get(), bufferData);
}
}

// Some materials, particularly MaterialX, require tangents data to be present
// in the vertex buffers. So for now, to avoid crashes, let's add dummy tungents.
// We may need to reevaluate it later.
const MHWRender::MVertexBufferDescriptor vbDesc(
"", MHWRender::MGeometry::kTangent, MHWRender::MGeometry::kFloat, 3);
VtVec3fArray tangents;
PreparePrimvarBuffer(
_pointsSharedData,
stateToCommit,
_tokens->tangents,
_tokens->tangents,
vbDesc,
GfVec3f(1.f, 0.f, 0.f));
}

// Prepare primvar buffers.
Expand Down

0 comments on commit fdcfcff

Please sign in to comment.