Skip to content

Commit

Permalink
Ignore usdGeom doubleSided parameter Autodesk#2099
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastienblor committed Sep 13, 2024
1 parent 1dd5339 commit 09373e5
Show file tree
Hide file tree
Showing 40 changed files with 6,098 additions and 6,332 deletions.
2 changes: 1 addition & 1 deletion libs/render_delegate/rprim.h
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class HdArnoldRprim : public HydraType {

if (checkSidedness && HdChangeTracker::IsDoubleSidedDirty(*dirtyBits, id)) {
param.Interrupt();
const auto doubleSided = sceneDelegate->GetDoubleSided(id);
const auto doubleSided = true; //sceneDelegate->GetDoubleSided(id);
_sidednessFlags.SetHydraFlag(doubleSided ? AI_RAY_ALL : AI_RAY_SUBSURFACE);
AiNodeSetByte(GetArnoldNode(), str::sidedness, _sidednessFlags.Compose());
}
Expand Down
11 changes: 11 additions & 0 deletions libs/render_delegate/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ PXR_NAMESPACE_OPEN_SCOPE
// clang-format off
TF_DEFINE_PRIVATE_TOKENS(_tokens,
((arnoldVisibility, "arnold:visibility"))
((arnoldSidedness, "arnold:sidedness"))
((visibilityPrefix, "visibility:"))
((sidednessPrefix, "sidedness:"))
((autobumpVisibilityPrefix, "autobump_visibility:"))
Expand Down Expand Up @@ -317,6 +318,16 @@ bool ConvertPrimvarToRayFlag(AtNode* node, const TfToken& name, const VtValue& v
visibility->SetPrimvarFlag(visibilityValue, true);
return true;
}
if (sidedness && name == _tokens->arnoldSidedness) {
uint8_t sidednessValue = VtValueGetInt(value);
AiNodeSetByte(node, str::sidedness, sidednessValue);
// In this case we want to force the visibility to be this current value.
// So we first need to remove any visibility flag, and then we set the new one
sidedness->SetPrimvarFlag(AI_RAY_ALL, false);
sidedness->SetPrimvarFlag(sidednessValue, true);
return true;
}

const auto* paramName = name.GetText() + str::t_arnold_prefix.size();
// We are checking if it's a visibility flag in form of
// primvars:arnold:visibility:xyz where xyz is a name of a ray type.
Expand Down
2 changes: 1 addition & 1 deletion libs/render_delegate/volume.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ void HdArnoldVolume::Sync(

if (HdChangeTracker::IsDoubleSidedDirty(*dirtyBits, id)) {
param.Interrupt();
const auto doubleSided = sceneDelegate->GetDoubleSided(id);
const auto doubleSided = true; //sceneDelegate->GetDoubleSided(id);
_sidednessFlags.SetHydraFlag(doubleSided ? AI_RAY_ALL : AI_RAY_SUBSURFACE);
const auto sidedness = _sidednessFlags.Compose();
_ForEachVolume([&](HdArnoldShape* s) { AiNodeSetByte(s->GetShape(), str::sidedness, sidedness); });
Expand Down
3 changes: 2 additions & 1 deletion libs/translator/reader/read_geometry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -160,12 +160,13 @@ static inline bool _ReadPointsAndVelocities(const UsdGeomPointBased &geom, AtNod
static inline void _ReadSidedness(UsdGeomGprim &geom, AtNode *node, float frame)
{
VtValue value;
if (geom.GetDoubleSidedAttr().Get(&value, frame) && VtValueGetBool(value))
if (true /*geom.GetDoubleSidedAttr().Get(&value, frame) && VtValueGetBool(value)*/)
AiNodeSetByte(node, str::sidedness, AI_RAY_ALL);
else {
// USD defaults to single sided mesh.
AiNodeSetByte(node, str::sidedness, AI_RAY_SUBSURFACE);
}

}

void ReadMeshLight(const UsdPrim &prim, UsdArnoldReaderContext &context, AtNode *node, const TimeSettings &time) {
Expand Down
3,871 changes: 1,934 additions & 1,937 deletions testsuite/test_0016/ref/reference.log

Large diffs are not rendered by default.

Binary file modified testsuite/test_0016/ref/reference.tif
Binary file not shown.
421 changes: 200 additions & 221 deletions testsuite/test_0017/ref/reference.log

Large diffs are not rendered by default.

Binary file modified testsuite/test_0017/ref/reference.tif
Binary file not shown.
2 changes: 1 addition & 1 deletion testsuite/test_0026/data/scene.usda
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ def Xform "root" (
float2[] primvars:st = [(0.0, 0.0), (1.0, 0.0), (0.0, 1.0), (1.0, 1.0)] (
interpolation = "faceVarying"
)

int primvars:arnold:sidedness = 0
int[] primvars:st:indices = [0, 1, 3, 2, 0, 1, 3, 2]
}

Expand Down
416 changes: 202 additions & 214 deletions testsuite/test_0035/ref/reference.log

Large diffs are not rendered by default.

Binary file modified testsuite/test_0035/ref/reference.tif
Binary file not shown.
1,700 changes: 849 additions & 851 deletions testsuite/test_0131/ref/reference.log

Large diffs are not rendered by default.

Binary file modified testsuite/test_0131/ref/reference.tif
Binary file not shown.
427 changes: 210 additions & 217 deletions testsuite/test_0157/ref/reference.log

Large diffs are not rendered by default.

Binary file modified testsuite/test_0157/ref/reference.tif
Binary file not shown.
415 changes: 202 additions & 213 deletions testsuite/test_0217/ref/reference.log

Large diffs are not rendered by default.

Binary file modified testsuite/test_0217/ref/reference.tif
Binary file not shown.
485 changes: 228 additions & 257 deletions testsuite/test_0221/ref/reference.log

Large diffs are not rendered by default.

Binary file modified testsuite/test_0221/ref/reference.tif
Binary file not shown.
471 changes: 216 additions & 255 deletions testsuite/test_0222/ref/reference.log

Large diffs are not rendered by default.

Binary file modified testsuite/test_0222/ref/reference.tif
Binary file not shown.
524 changes: 276 additions & 248 deletions testsuite/test_0229/ref/reference.log

Large diffs are not rendered by default.

Binary file modified testsuite/test_0229/ref/reference.tif
Binary file not shown.
565 changes: 270 additions & 295 deletions testsuite/test_0237/ref/reference.log

Large diffs are not rendered by default.

Binary file modified testsuite/test_0237/ref/reference.tif
Binary file not shown.
503 changes: 245 additions & 258 deletions testsuite/test_0243/ref/reference.log

Large diffs are not rendered by default.

Binary file modified testsuite/test_0243/ref/reference.tif
Binary file not shown.
443 changes: 219 additions & 224 deletions testsuite/test_0316/ref/reference.log

Large diffs are not rendered by default.

Binary file modified testsuite/test_0316/ref/reference.tif
Binary file not shown.
499 changes: 221 additions & 278 deletions testsuite/test_1331/ref/reference.log

Large diffs are not rendered by default.

Binary file modified testsuite/test_1331/ref/reference.tif
Binary file not shown.
Binary file modified testsuite/test_1352/ref/reference.tif
Binary file not shown.
630 changes: 305 additions & 325 deletions testsuite/test_1420/ref/reference.log

Large diffs are not rendered by default.

Binary file modified testsuite/test_1420/ref/reference.tif
Binary file not shown.
572 changes: 277 additions & 295 deletions testsuite/test_1468.2/ref/reference.log

Large diffs are not rendered by default.

Binary file modified testsuite/test_1468.2/ref/reference.tif
Binary file not shown.
468 changes: 228 additions & 240 deletions testsuite/test_1718/ref/reference.log

Large diffs are not rendered by default.

Binary file modified testsuite/test_1718/ref/reference.tif
Binary file not shown.
Binary file modified testsuite/test_1735/ref/reference.tif
Binary file not shown.
Binary file modified testsuite/test_1837/ref/reference.tif
Binary file not shown.

0 comments on commit 09373e5

Please sign in to comment.