Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MAYA-114567 safely test opacity values when iterpolation is uniform #1906

Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 22 additions & 1 deletion lib/mayaUsd/render/vp2RenderDelegate/mesh.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1732,7 +1732,8 @@ void HdVP2Mesh::_UpdateDrawItem(
// _updateRepr. Find the triangles which represent faces in the matching
// geom subset and add those triangles to the index buffer for renderItem.

VtVec3iArray trianglesFaceVertexIndices; // for this item only!
VtVec3iArray trianglesFaceVertexIndices; // for this item only!
std::vector<int> faceIds;
if (_meshSharedData->_faceIdToGeomSubsetId.size() == 0
|| reprToken == HdVP2ReprTokens->defaultMaterial) {
// If there is no mapping from face to render item or if this is the default
Expand All @@ -1746,6 +1747,7 @@ void HdVP2Mesh::_UpdateDrawItem(
_meshSharedData->_primitiveParam[triangleId]);
if (_meshSharedData->_faceIdToGeomSubsetId[faceId]
== renderItemData._geomSubset.id) {
faceIds.push_back(faceId);
trianglesFaceVertexIndices.push_back(
_meshSharedData->_trianglesFaceVertexIndices[triangleId]);
}
Expand All @@ -1762,6 +1764,25 @@ void HdVP2Mesh::_UpdateDrawItem(
if (alphaArray.size() > 0) {
if (alphaInterp == HdInterpolationConstant) {
renderItemData._transparent = (alphaArray[0] < 0.999f);
} else if (alphaInterp == HdInterpolationUniform) {
if (faceIds.size() > 0) {
// it is a geom subset
for (auto& faceId : faceIds) {
if (alphaArray[faceId] < 0.999f) {
renderItemData._transparent = true;
break;
}
}
} else {
// no geom subsets, check every face
int numFaces = topologyToUse.GetNumFaces();
for (int faceId = 0; faceId < numFaces; faceId++) {
if (alphaArray[faceId] < 0.999f) {
renderItemData._transparent = true;
break;
}
}
}
} else {
for (const auto& triangle : trianglesFaceVertexIndices) {

Expand Down