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

Improve translation of normals primvars in Hydra #1963

Merged
merged 12 commits into from
Jul 16, 2024

Conversation

sebastienblor
Copy link
Collaborator

@sebastienblor sebastienblor commented Jul 10, 2024

test_1483 was failing due to incorrect handling of normals in some cases. Debugging showed that we were skipping the authoring of normals in some cases, since _ConvertValueToArnoldParameter was actually doing nothing when the argument "requiredValues" was not set. Also, HdArnoldSampledPrimvarType is created with 3 samples so when we were pushing a value we ended with 4 of them (the first being empty). Fixing this solved these tests, but as a side effect it then caused other tests to fail because of other issues :

  • We needed to ensure that we support vertex-interpolated normals with an index list. For that I add a new function GenerateVertexIds taking that can return an indices array with the size expected by Arnold. For curves, since there is already a remapping of cvs done to match Arnold, it was safer to flatten the values and get rid of the indices
  • We need to ensure that the amount of normal keys matches the amount of vertex keys. This is already handled in the procedural but not in the delegate. For that I added a function _RemapNormalKeys

As a separate task, we should rework the ifdefs related to USD_HAS_SAMPLE_INDEXED_PRIMVAR. I might be missing something, but what I'm seeing seems overcomplicated, we should probably be able to remove the ifdef from HdArnoldSample which would then simplify a lot of code
Fixes #1959

@sebastienblor sebastienblor marked this pull request as draft July 10, 2024 09:08
@sebastienblor sebastienblor changed the title Pr/1959 Improve authoring of normals primvars Jul 10, 2024
@sebastienblor sebastienblor changed the title Improve authoring of normals primvars Improve translation of normals primvars in Hydra Jul 10, 2024
@sebastienblor sebastienblor marked this pull request as ready for review July 10, 2024 10:25
@@ -681,30 +681,24 @@ void HdArnoldGetPrimvars(
// The number of motion keys has to be matched between points and normals, so if there are multiple
// position keys, so we are forcing the user to use the SamplePrimvars function.
if (multiplePositionKeys && primvarDesc.name == HdTokens->normals) {
HdArnoldInsertPrimvar(primvars, primvarDesc.name, primvarDesc.role, primvarDesc.interpolation,
#ifdef USD_HAS_SAMPLE_INDEXED_PRIMVAR
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

May be we could remove this ifdef as it was used for very old version ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's needed for versions older than 21.05, so I think we still need it ?

@sebastienblor sebastienblor merged commit d221f8a into Autodesk:master Jul 16, 2024
9 checks passed
@sebastienblor sebastienblor deleted the pr/1959 branch July 16, 2024 12:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Hydra test_1483 : normals not authored properly in some cases
2 participants