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

Fix the incorrect orientation of the PointInstancer instances in the render delegate #1777

Merged
merged 3 commits into from
Dec 8, 2023
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
- [usd#1735](https://github.com/Autodesk/arnold-usd/issues/1735) - Fix usdskel geometry and motion blur interpolation outside the keyframe boundaries.
- [usd#1524](https://github.com/Autodesk/arnold-usd/issues/1524) - Fix material binding on instances under a SkelRoot
- [usd#1718](https://github.com/Autodesk/arnold-usd/issues/1718) - Support primvars:arnold attributes in Arnold typed schemas
- [usd#1776](https://github.com/Autodesk/arnold-usd/issues/1776) - Fix incorrect PointInstancer instance orientations in the render delegate.

## [7.2.4.1] - 2023-10-18

Expand Down
2 changes: 1 addition & 1 deletion libs/render_delegate/instancer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ void HdArnoldInstancer::CalculateInstanceMatrices(HdArnoldRenderDelegate* render
if (rotates.size() > static_cast<size_t>(instanceIndex)) {
GfMatrix4d m(1.0);
#if PXR_VERSION >= 2008
m.SetRotate(GfRotation{rotates[instanceIndex]});
m.SetRotate(rotates[instanceIndex]);
#else
const auto quat = rotates[instanceIndex];
m.SetRotate(GfRotation(GfQuaternion(quat[0], GfVec3f(quat[1], quat[2], quat[3]))));
Expand Down
5 changes: 5 additions & 0 deletions testsuite/test_1776/README
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Test instance orientations, positions and scales

author: cyril.pichard@autodesk.com

PARAMS: {'scene':'test.usda'}
88 changes: 88 additions & 0 deletions testsuite/test_1776/data/test.usda
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
#usda 1.0
(
endTimeCode = 1
framesPerSecond = 24
metersPerUnit = 1
startTimeCode = 1
timeCodesPerSecond = 24
upAxis = "Y"
)

def PointInstancer "point_instancer" (
kind = "group"
)
{
float3[] extent.timeSamples = {
1: [(-240.63618, -10, -0.96745825), (-180.62123, 74.7527, 94.624466)],
}
int64[] invisibleIds = []
quath[] orientations = [(1, 0, 0.300049, 0)]
point3f[] positions = [(2, -5, -3)]
matrix3d[] primvars:transform (
interpolation = "varying"
)
matrix3d[] primvars:transform.timeSamples = {
1: [( (0.5, 0, 0.5), (0, 1, 0), (0.5, 0, 0.5) )],
}
int[] protoIndices = [0]
rel prototypes = </point_instancer/Prototypes/ASSET>
float3[] scales = [(0.8, 1.1, 0.9)]

def Scope "Prototypes" (
kind = "group"
)
{
def Xform "ASSET"
{
matrix4d xformOp:transform:xform = ( (1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1) )
uniform token[] xformOpOrder = ["xformOp:transform:xform"]

def Mesh "mesh_0"
{
float3[] extent = [(-2.003641, -2.4241421, -3.0486922), (1.5529331, 1.3240513, 1)]
int[] faceVertexCounts = [3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 32, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4]
int[] faceVertexIndices = [0, 32, 1, 1, 32, 2, 2, 32, 3, 3, 32, 4, 4, 32, 5, 5, 32, 6, 6, 32, 7, 7, 32, 8, 8, 32, 9, 9, 32, 10, 10, 32, 11, 11, 32, 12, 12, 32, 13, 13, 32, 14, 14, 32, 15, 15, 32, 16, 16, 32, 17, 17, 32, 18, 18, 32, 19, 19, 32, 20, 20, 32, 21, 21, 32, 22, 22, 32, 23, 23, 32, 24, 24, 32, 25, 25, 32, 26, 26, 32, 27, 27, 32, 28, 28, 32, 29, 29, 32, 30, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 30, 32, 31, 31, 32, 0, 33, 34, 36, 35, 35, 36, 40, 39, 39, 40, 38, 37, 37, 38, 34, 33, 35, 39, 37, 33, 40, 36, 34, 38, 41, 42, 44, 43, 43, 44, 48, 47, 47, 48, 46, 45, 45, 46, 42, 41, 43, 47, 45, 41, 48, 44, 42, 46]
normal3f[] normals = [(0.087753676, 0.89097667, 0.4454883), (0.087753676, 0.89097667, 0.4454883), (0.087753676, 0.89097667, 0.4454883), (0.25988826, 0.8567369, 0.44548833), (0.25988826, 0.8567369, 0.44548833), (0.25988826, 0.8567369, 0.44548833), (0.4220357, 0.7895733, 0.44548845), (0.4220357, 0.7895733, 0.44548845), (0.4220357, 0.7895733, 0.44548845), (0.56796455, 0.6920667, 0.44548836), (0.56796455, 0.6920667, 0.44548836), (0.56796455, 0.6920667, 0.44548836), (0.6920667, 0.56796455, 0.4454883), (0.6920667, 0.56796455, 0.4454883), (0.6920667, 0.56796455, 0.4454883), (0.7895733, 0.4220357, 0.4454883), (0.7895733, 0.4220357, 0.4454883), (0.7895733, 0.4220357, 0.4454883), (0.8567369, 0.25988826, 0.4454883), (0.8567369, 0.25988826, 0.4454883), (0.8567369, 0.25988826, 0.4454883), (0.89097667, 0.087753676, 0.44548833), (0.89097667, 0.087753676, 0.44548833), (0.89097667, 0.087753676, 0.44548833), (0.89097667, -0.087753676, 0.44548833), (0.89097667, -0.087753676, 0.44548833), (0.89097667, -0.087753676, 0.44548833), (0.8567369, -0.25988826, 0.44548833), (0.8567369, -0.25988826, 0.44548833), (0.8567369, -0.25988826, 0.44548833), (0.7895733, -0.4220357, 0.4454883), (0.7895733, -0.4220357, 0.4454883), (0.7895733, -0.4220357, 0.4454883), (0.6920667, -0.56796455, 0.4454883), (0.6920667, -0.56796455, 0.4454883), (0.6920667, -0.56796455, 0.4454883), (0.56796455, -0.6920667, 0.4454883), (0.56796455, -0.6920667, 0.4454883), (0.56796455, -0.6920667, 0.4454883), (0.4220357, -0.7895733, 0.44548845), (0.4220357, -0.7895733, 0.44548845), (0.4220357, -0.7895733, 0.44548845), (0.25988826, -0.8567369, 0.4454883), (0.25988826, -0.8567369, 0.4454883), (0.25988826, -0.8567369, 0.4454883), (0.087753676, -0.89097667, 0.4454883), (0.087753676, -0.89097667, 0.4454883), (0.087753676, -0.89097667, 0.4454883), (-0.087753676, -0.89097667, 0.4454883), (-0.087753676, -0.89097667, 0.4454883), (-0.087753676, -0.89097667, 0.4454883), (-0.25988826, -0.8567369, 0.44548833), (-0.25988826, -0.8567369, 0.44548833), (-0.25988826, -0.8567369, 0.44548833), (-0.4220357, -0.7895733, 0.44548845), (-0.4220357, -0.7895733, 0.44548845), (-0.4220357, -0.7895733, 0.44548845), (-0.56796455, -0.6920667, 0.44548836), (-0.56796455, -0.6920667, 0.44548836), (-0.56796455, -0.6920667, 0.44548836), (-0.6920667, -0.56796455, 0.4454883), (-0.6920667, -0.56796455, 0.4454883), (-0.6920667, -0.56796455, 0.4454883), (-0.7895733, -0.4220357, 0.4454883), (-0.7895733, -0.4220357, 0.4454883), (-0.7895733, -0.4220357, 0.4454883), (-0.8567369, -0.25988826, 0.4454883), (-0.8567369, -0.25988826, 0.4454883), (-0.8567369, -0.25988826, 0.4454883), (-0.89097667, -0.087753676, 0.44548833), (-0.89097667, -0.087753676, 0.44548833), (-0.89097667, -0.087753676, 0.44548833), (-0.89097667, 0.087753676, 0.44548833), (-0.89097667, 0.087753676, 0.44548833), (-0.89097667, 0.087753676, 0.44548833), (-0.8567369, 0.25988826, 0.44548833), (-0.8567369, 0.25988826, 0.44548833), (-0.8567369, 0.25988826, 0.44548833), (-0.7895733, 0.4220357, 0.4454883), (-0.7895733, 0.4220357, 0.4454883), (-0.7895733, 0.4220357, 0.4454883), (-0.6920667, 0.56796455, 0.4454883), (-0.6920667, 0.56796455, 0.4454883), (-0.6920667, 0.56796455, 0.4454883), (-0.56796455, 0.6920667, 0.4454883), (-0.56796455, 0.6920667, 0.4454883), (-0.56796455, 0.6920667, 0.4454883), (-0.4220357, 0.7895733, 0.44548845), (-0.4220357, 0.7895733, 0.44548845), (-0.4220357, 0.7895733, 0.44548845), (-1.9095209e-8, 0, -1), (-1.9095209e-8, 0, -1), (-1.9095209e-8, 0, -1), (-1.9095209e-8, 0, -1), (-1.9095209e-8, 0, -1), (-1.9095209e-8, 0, -1), (-1.9095209e-8, 0, -1), (-1.9095209e-8, 0, -1), (-1.9095209e-8, 0, -1), (-1.9095209e-8, 0, -1), (-1.9095209e-8, 0, -1), (-1.9095209e-8, 0, -1), (-1.9095209e-8, 0, -1), (-1.9095209e-8, 0, -1), (-1.9095209e-8, 0, -1), (-1.9095209e-8, 0, -1), (-1.9095209e-8, 0, -1), (-1.9095209e-8, 0, -1), (-1.9095209e-8, 0, -1), (-1.9095209e-8, 0, -1), (-1.9095209e-8, 0, -1), (-1.9095209e-8, 0, -1), (-1.9095209e-8, 0, -1), (-1.9095209e-8, 0, -1), (-1.9095209e-8, 0, -1), (-1.9095209e-8, 0, -1), (-1.9095209e-8, 0, -1), (-1.9095209e-8, 0, -1), (-1.9095209e-8, 0, -1), (-1.9095209e-8, 0, -1), (-1.9095209e-8, 0, -1), (-1.9095209e-8, 0, -1), (-0.25988826, 0.8567369, 0.4454883), (-0.25988826, 0.8567369, 0.4454883), (-0.25988826, 0.8567369, 0.4454883), (-0.087753676, 0.89097667, 0.4454883), (-0.087753676, 0.89097667, 0.4454883), (-0.087753676, 0.89097667, 0.4454883), (-0.28579602, 0.07560519, -0.95530343), (-0.28579602, 0.07560519, -0.95530343), (-0.28579602, 0.07560519, -0.95530343), (-0.28579602, 0.07560519, -0.95530343), (-0.7356793, 0.6215021, 0.269279), (-0.7356793, 0.6215021, 0.269279), (-0.7356793, 0.6215021, 0.269279), (-0.7356793, 0.6215021, 0.269279), (0.28579608, -0.07560521, 0.95530343), (0.28579608, -0.07560521, 0.95530343), (0.28579608, -0.07560521, 0.95530343), (0.28579608, -0.07560521, 0.95530343), (0.7356792, -0.6215021, -0.26927897), (0.7356792, -0.6215021, -0.26927897), (0.7356792, -0.6215021, -0.26927897), (0.7356792, -0.6215021, -0.26927897), (0.61408186, 0.7797559, -0.12200169), (0.61408186, 0.7797559, -0.12200169), (0.61408186, 0.7797559, -0.12200169), (0.61408186, 0.7797559, -0.12200169), (-0.6140819, -0.77975583, 0.12200168), (-0.6140819, -0.77975583, 0.12200168), (-0.6140819, -0.77975583, 0.12200168), (-0.6140819, -0.77975583, 0.12200168), (-0.038560033, -0.7446701, -0.66631794), (-0.038560033, -0.7446701, -0.66631794), (-0.038560033, -0.7446701, -0.66631794), (-0.038560033, -0.7446701, -0.66631794), (-0.716196, 0.48559964, -0.5012546), (-0.716196, 0.48559964, -0.5012546), (-0.716196, 0.48559964, -0.5012546), (-0.716196, 0.48559964, -0.5012546), (0.038560092, 0.7446701, 0.66631794), (0.038560092, 0.7446701, 0.66631794), (0.038560092, 0.7446701, 0.66631794), (0.038560092, 0.7446701, 0.66631794), (0.71619606, -0.48559973, 0.5012547), (0.71619606, -0.48559973, 0.5012547), (0.71619606, -0.48559973, 0.5012547), (0.71619606, -0.48559973, 0.5012547), (0.696833, 0.45788592, -0.5520546), (0.696833, 0.45788592, -0.5520546), (0.696833, 0.45788592, -0.5520546), (0.696833, 0.45788592, -0.5520546), (-0.69683313, -0.45788574, 0.5520546), (-0.69683313, -0.45788574, 0.5520546), (-0.69683313, -0.45788574, 0.5520546), (-0.69683313, -0.45788574, 0.5520546)] (
interpolation = "faceVarying"
)
point3f[] points = [(0, 1, -1), (0.19509032, 0.98078525, -1), (0.38268346, 0.9238795, -1), (0.55557024, 0.8314696, -1), (0.70710677, 0.70710677, -1), (0.8314696, 0.55557024, -1), (0.9238795, 0.38268346, -1), (0.98078525, 0.19509032, -1), (1, 0, -1), (0.98078525, -0.19509032, -1), (0.9238795, -0.38268346, -1), (0.8314696, -0.55557024, -1), (0.70710677, -0.70710677, -1), (0.55557024, -0.8314696, -1), (0.38268346, -0.9238795, -1), (0.19509032, -0.98078525, -1), (0, -1, -1), (-0.19509032, -0.98078525, -1), (-0.38268346, -0.9238795, -1), (-0.55557024, -0.8314696, -1), (-0.70710677, -0.70710677, -1), (-0.8314696, -0.55557024, -1), (-0.9238795, -0.38268346, -1), (-0.98078525, -0.19509032, -1), (-1, 0, -1), (-0.98078525, 0.19509032, -1), (-0.9238795, 0.38268346, -1), (-0.8314696, 0.55557024, -1), (-0.70710677, 0.70710677, -1), (-0.55557024, 0.8314696, -1), (-0.38268346, 0.9238795, -1), (-0.19509032, 0.98078525, -1), (0, 0, 1), (0.9813409, 0.08104706, -2.7391376), (-0.24682286, -1.4784644, -2.4951344), (-0.4900178, 1.3240513, -2.20058), (-1.7181815, -0.23546016, -1.9565766), (1.5529331, -0.07016337, -0.8285312), (0.32476935, -1.6296748, -0.5845279), (0.08157441, 1.1728408, -0.28997338), (-1.1465893, -0.3866706, -0.045970082), (0.8224175, -1.5083703, -2.046183), (-0.57124877, -2.4241421, -0.94207394), (-0.60997474, -0.5371709, -3.0486922), (-2.003641, -1.4529426, -1.9445833), (0.8995377, -0.019030184, -0.71354705), (-0.4941285, -0.9348018, 0.39056194), (-0.5328546, 0.9521692, -1.7160565), (-1.9265206, 0.036397517, -0.61194736)]
double3 xformOp:translate = (0, 0, 0)
uniform token[] xformOpOrder = ["xformOp:translate"]
custom bool primvars:arnold:smoothing = 0
}
}
}
}

def SphereLight "Light"
{
float inputs:intensity = 2
float inputs:radius = 10
float3 xformOp:rotateXYZ.timeSamples = {
1: (-0, -180, 0),
}
double3 xformOp:translate.timeSamples = {
1: (-5.376137543640766, -3.7901665562419242, 11.303161481354397),
}
uniform token[] xformOpOrder = ["xformOp:translate", "xformOp:rotateXYZ"]
}

def "Cameras"
{
def Camera "camera"
{
float4[] clippingPlanes = []
float2 clippingRange = (0.001, 1000000)
float focalLength = 18.147562
float focusDistance = 6.69269
float fStop = 0
float horizontalAperture = 20.955
float horizontalApertureOffset = 0
token projection = "perspective"
float verticalAperture = 11.695814
float verticalApertureOffset = 0
matrix4d xformOp:transform = ( (0.8260121945537635, 0.12253087208816199, 0.5501727363599456, 0), (-0.0028013580966152474, 0.9769657977202224, -0.21337755851472312, 0), (-0.5636452845906637, 0.1747112345277316, 0.8073289154294585, 0), (-3.3020119817570475, -3.6787410353590566, 2.742669349510537, 1) )
uniform token[] xformOpOrder = ["xformOp:transform"]
}
}

Binary file added testsuite/test_1776/ref/reference.tif
Binary file not shown.