From 8dcb4dafbe70d2221525c30871b3523516557721 Mon Sep 17 00:00:00 2001 From: stevk <31048895+stevk@users.noreply.github.com> Date: Tue, 13 Nov 2018 12:55:05 -0800 Subject: [PATCH 1/2] Hide the model that has > 4 jointweights per vertex until the spec is clearer on this case --- Output/Animation_Skin/Animation_Skin_12.bin | Bin 1784 -> 0 bytes Output/Animation_Skin/Animation_Skin_12.gltf | 311 ------------------ .../SampleImages/Animation_Skin_12.png | Bin 1226 -> 0 bytes .../Figures/Thumbnails/Animation_Skin_12.png | Bin 1226 -> 0 bytes Output/Animation_Skin/Manifest.json | 11 - Output/Animation_Skin/README.md | 11 +- Output/Manifest.json | 11 - Source/ModelGroups/Animation_Skin.cs | 114 +++---- Source/ReadmeTemplates/Animation_Skin.md | 10 +- 9 files changed, 71 insertions(+), 397 deletions(-) delete mode 100644 Output/Animation_Skin/Animation_Skin_12.bin delete mode 100644 Output/Animation_Skin/Animation_Skin_12.gltf delete mode 100644 Output/Animation_Skin/Figures/SampleImages/Animation_Skin_12.png delete mode 100644 Output/Animation_Skin/Figures/Thumbnails/Animation_Skin_12.png diff --git a/Output/Animation_Skin/Animation_Skin_12.bin b/Output/Animation_Skin/Animation_Skin_12.bin deleted file mode 100644 index e18fae14ac7afac31930adb2be65f88173d704a7..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1784 zcmd6oJx{|h5QbeS<@;-50K@=)pe(R7>Cmw&Os&MkjF@ZL<$(U|(# zo?lwNm9q!6%x!33w3XGD*5>wks{gf7MXjr6j#Pu)bogw&spM1rhl?fu{&daxnImXo z=1cABxJB=mIB!||KK>?qk7D)A5j5-Pex3X4Y5rcX=e_mkAQt8bn)P2-?g|f7#{c2R t=NEbH8nN|aj-Xlp$9~bPx#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D1Yb!+K~!i%?V4*y z6j2n%XVi5~wKx%H3qG)kRE~yONOAuF!}pBV`I^#@m*6~&?y+vX7Q>7mN9?w5p>|AXVQVtF(b5o*hN81DfDXtPbo370J< zb2T`O5(bPK;rHP&H%Bz2jm?p0c~QA3+A&br{#{gF7ZX3G&tLC#Q3cr57OPYX8n!U2VGFYwwlJ$PXocawExr|{xwCs$E+tE!*2NA*t6>YX8fwXdUZXB9=%jZ6 zVb!Io+DWemjvUS%*iF`Oe*I=ol_``?6jyBI{v{ni%Zub}+}ya9ipKo`nq$G0gi9*ow}L(R6gM7q61hNKD|iY;dQggjz;XhvP7H87S;ne~sK3 z%};}z?5>ogKDurcBH&ZL`N}i~3iB~P9p97yK7El+lK8PCp6@**xuK{;>76spghN=} zv#5_Pd_(kP@R7TXB#9R|x4RFp6kJ>HfZgW}YJd;O@@RQ!R!x2BGl|=VS5e>=w%R9rO&DU{hk?RYEa`EGYwP*@l`CeD z<&!6g1VaX(2WQw&a(317o;>Q6CYq!~l9^0h9}@-{$jWq2pYord775{)W5MB51q7-J zFoiJCaOs-p36oY89Ht0Gbs6+z(~fyVQ6M-~fLW4<$HUg#cf4+jWLP$NvL`d6+Z7km otGK4lilJckPz)Mdn6+S-f3mWF1XBD#B>(^b07*qoM6N<$f*}($K>z>% diff --git a/Output/Animation_Skin/Figures/Thumbnails/Animation_Skin_12.png b/Output/Animation_Skin/Figures/Thumbnails/Animation_Skin_12.png deleted file mode 100644 index de4aa20816dc4bc5b50611ff31c5b6a5a0d3ec4c..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 1226 zcmV;*1U37KP)Px#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D1Yb!+K~!i%?V4*y z6j2n%XVi5~wKx%H3qG)kRE~yONOAuF!}pBV`I^#@m*6~&?y+vX7Q>7mN9?w5p>|AXVQVtF(b5o*hN81DfDXtPbo370J< zb2T`O5(bPK;rHP&H%Bz2jm?p0c~QA3+A&br{#{gF7ZX3G&tLC#Q3cr57OPYX8n!U2VGFYwwlJ$PXocawExr|{xwCs$E+tE!*2NA*t6>YX8fwXdUZXB9=%jZ6 zVb!Io+DWemjvUS%*iF`Oe*I=ol_``?6jyBI{v{ni%Zub}+}ya9ipKo`nq$G0gi9*ow}L(R6gM7q61hNKD|iY;dQggjz;XhvP7H87S;ne~sK3 z%};}z?5>ogKDurcBH&ZL`N}i~3iB~P9p97yK7El+lK8PCp6@**xuK{;>76spghN=} zv#5_Pd_(kP@R7TXB#9R|x4RFp6kJ>HfZgW}YJd;O@@RQ!R!x2BGl|=VS5e>=w%R9rO&DU{hk?RYEa`EGYwP*@l`CeD z<&!6g1VaX(2WQw&a(317o;>Q6CYq!~l9^0h9}@-{$jWq2pYord775{)W5MB51q7-J zFoiJCaOs-p36oY89Ht0Gbs6+z(~fyVQ6M-~fLW4<$HUg#cf4+jWLP$NvL`d6+Z7km otGK4lilJckPz)Mdn6+S-f3mWF1XBD#B>(^b07*qoM6N<$f*}($K>z>% diff --git a/Output/Animation_Skin/Manifest.json b/Output/Animation_Skin/Manifest.json index 8c290fbc..a82f4a08 100644 --- a/Output/Animation_Skin/Manifest.json +++ b/Output/Animation_Skin/Manifest.json @@ -132,17 +132,6 @@ 1.0 ] } - }, - { - "fileName": "Animation_Skin_12.gltf", - "sampleImageName": "Figures/SampleImages/Animation_Skin_12.png", - "camera": { - "translation": [ - 1.5, - 0.0, - 1.0 - ] - } } ] } \ No newline at end of file diff --git a/Output/Animation_Skin/README.md b/Output/Animation_Skin/README.md index 4fcf400a..0893d840 100644 --- a/Output/Animation_Skin/README.md +++ b/Output/Animation_Skin/README.md @@ -6,9 +6,13 @@ skinA | skinB | skinC :---: | :---: | :---: | | -skinD | skinE | skinF -:---: | :---: | :---: - | | +skinD | skinE +:---: | :---: + | + + + + The following table shows the properties that are set for a given model. @@ -26,5 +30,4 @@ The following table shows the properties that are set for a given model. | [09](Animation_Skin_09.gltf)
[View](https://bghgary.github.io/glTF-Assets-Viewer/?folder=2&model=9) | [](Figures/SampleImages/Animation_Skin_09.png) | `skinC` where all of the joints have a local rotation of -10 degrees, except the root which is rotated -90 degrees. | | [10](Animation_Skin_10.gltf)
[View](https://bghgary.github.io/glTF-Assets-Viewer/?folder=2&model=10) | [](Figures/SampleImages/Animation_Skin_10.png) | `skinD` where each joint is animating with a rotation. There is a transform node in the joint hierarchy that is not a joint. That node has a mesh attached to it in order to show its location. | | [11](Animation_Skin_11.gltf)
[View](https://bghgary.github.io/glTF-Assets-Viewer/?folder=2&model=11) | [](Figures/SampleImages/Animation_Skin_11.png) | `skinE`. | -| [12](Animation_Skin_12.gltf)
[View](https://bghgary.github.io/glTF-Assets-Viewer/?folder=2&model=12) | [](Figures/SampleImages/Animation_Skin_12.png) | `skinF`. | diff --git a/Output/Manifest.json b/Output/Manifest.json index 7e979f21..6eff3852 100644 --- a/Output/Manifest.json +++ b/Output/Manifest.json @@ -297,17 +297,6 @@ 1.0 ] } - }, - { - "fileName": "Animation_Skin_12.gltf", - "sampleImageName": "Figures/SampleImages/Animation_Skin_12.png", - "camera": { - "translation": [ - 1.5, - 0.0, - 1.0 - ] - } } ] }, diff --git a/Source/ModelGroups/Animation_Skin.cs b/Source/ModelGroups/Animation_Skin.cs index e064fd63..91e24efa 100644 --- a/Source/ModelGroups/Animation_Skin.cs +++ b/Source/ModelGroups/Animation_Skin.cs @@ -352,63 +352,63 @@ Runtime.Animation CreateFoldingAnimation(Runtime.Node jointRootNode, List { model.Camera = distantCamera; }), - CreateModel((properties, animations, nodes) => { - foreach (Runtime.Node node in Nodes.CreateFoldingPlaneSkin("skinF", 8, 9, vertexVerticalSpacingMultiplier: 0.5f)) - { - nodes.Add(node); - } - - // Rotate each joint node, except the root which already has the desired rotation - Runtime.Node nodeCheck = nodes[1].Children.First(); - float rotationRadian = FloatMath.ConvertDegreesToRadians(-10.0f); - Quaternion rotationQuaternion = Quaternion.CreateFromYawPitchRoll(0.0f, rotationRadian, 0.0f); - nodeCheck.Rotation = rotationQuaternion; - while (nodeCheck.Children != null) - { - foreach (Runtime.Node node in nodeCheck.Children) - { - node.Rotation = rotationQuaternion; - } - nodeCheck = nodeCheck.Children.First(); - } - - // Rebuild the inverseBindMatrix for each joint (except the root) to work with the new rotation - var skinJointList = (List)nodes[0].Skin.SkinJoints; - for (int skinJointIndex = 1; skinJointIndex < skinJointList.Count(); skinJointIndex++) - { - Matrix4x4 translationInverseBindMatrix = skinJointList.ElementAt(skinJointIndex).InverseBindMatrix; - Matrix4x4.Invert(Matrix4x4.CreateRotationX(rotationRadian * (skinJointIndex + 1)) , out Matrix4x4 invertedRotation); - skinJointList.ElementAt(skinJointIndex).InverseBindMatrix = Matrix4x4.Multiply(translationInverseBindMatrix, invertedRotation); - } - - // Rebuild weights to include every joint instead of just the ones with a weight > 0 - var weightList = (List>)nodes[0].Mesh.MeshPrimitives.First().VertexJointWeights; - for (int weightIndex = 0; weightIndex < weightList.Count(); weightIndex++) - { - var jointWeight = new List(); - - for (int skinJointIndex = 0; skinJointIndex < skinJointList.Count; skinJointIndex++) - { - int weightToUse = 0; - // Set the weight to 1 if the skinJoint is at the same level as the vertex. - // Or Set the weight to 1 if the vertex is further out than the last skinjoint and the last skinjoint is being set. - if (skinJointIndex == (weightIndex / 2) || (((weightIndex / 2) > skinJointList.Count - 1) && (skinJointIndex == skinJointList.Count - 1)) ) - { - weightToUse = 1; - } - - jointWeight.Add(new Runtime.JointWeight - { - Joint = skinJointList[skinJointIndex], - Weight = weightToUse, - }); - } - - weightList[weightIndex] = jointWeight; - } - - properties.Add(new Property(PropertyName.Description, "`skinF`.")); - }, (model) => { model.Camera = distantCamera; }), + //CreateModel((properties, animations, nodes) => { + // foreach (Runtime.Node node in Nodes.CreateFoldingPlaneSkin("skinF", 8, 9, vertexVerticalSpacingMultiplier: 0.5f)) + // { + // nodes.Add(node); + // } + + // // Rotate each joint node, except the root which already has the desired rotation + // Runtime.Node nodeCheck = nodes[1].Children.First(); + // float rotationRadian = FloatMath.ConvertDegreesToRadians(-10.0f); + // Quaternion rotationQuaternion = Quaternion.CreateFromYawPitchRoll(0.0f, rotationRadian, 0.0f); + // nodeCheck.Rotation = rotationQuaternion; + // while (nodeCheck.Children != null) + // { + // foreach (Runtime.Node node in nodeCheck.Children) + // { + // node.Rotation = rotationQuaternion; + // } + // nodeCheck = nodeCheck.Children.First(); + // } + + // // Rebuild the inverseBindMatrix for each joint (except the root) to work with the new rotation + // var skinJointList = (List)nodes[0].Skin.SkinJoints; + // for (int skinJointIndex = 1; skinJointIndex < skinJointList.Count(); skinJointIndex++) + // { + // Matrix4x4 translationInverseBindMatrix = skinJointList.ElementAt(skinJointIndex).InverseBindMatrix; + // Matrix4x4.Invert(Matrix4x4.CreateRotationX(rotationRadian * (skinJointIndex + 1)) , out Matrix4x4 invertedRotation); + // skinJointList.ElementAt(skinJointIndex).InverseBindMatrix = Matrix4x4.Multiply(translationInverseBindMatrix, invertedRotation); + // } + + // // Rebuild weights to include every joint instead of just the ones with a weight > 0 + // var weightList = (List>)nodes[0].Mesh.MeshPrimitives.First().VertexJointWeights; + // for (int weightIndex = 0; weightIndex < weightList.Count(); weightIndex++) + // { + // var jointWeight = new List(); + + // for (int skinJointIndex = 0; skinJointIndex < skinJointList.Count; skinJointIndex++) + // { + // int weightToUse = 0; + // // Set the weight to 1 if the skinJoint is at the same level as the vertex. + // // Or Set the weight to 1 if the vertex is further out than the last skinjoint and the last skinjoint is being set. + // if (skinJointIndex == (weightIndex / 2) || (((weightIndex / 2) > skinJointList.Count - 1) && (skinJointIndex == skinJointList.Count - 1)) ) + // { + // weightToUse = 1; + // } + + // jointWeight.Add(new Runtime.JointWeight + // { + // Joint = skinJointList[skinJointIndex], + // Weight = weightToUse, + // }); + // } + + // weightList[weightIndex] = jointWeight; + // } + + // properties.Add(new Property(PropertyName.Description, "`skinF`. Each vertex has weights for more than four joints.")); + //}, (model) => { model.Camera = distantCamera; }), }; GenerateUsedPropertiesList(); diff --git a/Source/ReadmeTemplates/Animation_Skin.md b/Source/ReadmeTemplates/Animation_Skin.md index b7f25a55..9d2f6d10 100644 --- a/Source/ReadmeTemplates/Animation_Skin.md +++ b/Source/ReadmeTemplates/Animation_Skin.md @@ -6,9 +6,13 @@ skinA | skinB | skinC :---: | :---: | :---: | | -skinD | skinE | skinF -:---: | :---: | :---: - | | +skinD | skinE +:---: | :---: + | + + + + The following table shows the properties that are set for a given model. From 048cf21994be93e1d20f4bbc519742e957b898aa Mon Sep 17 00:00:00 2001 From: stevk <31048895+stevk@users.noreply.github.com> Date: Wed, 14 Nov 2018 10:54:09 -0800 Subject: [PATCH 2/2] Add a comment explaining why the >4 jointweight model was removed --- Source/ModelGroups/Animation_Skin.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/Source/ModelGroups/Animation_Skin.cs b/Source/ModelGroups/Animation_Skin.cs index 91e24efa..190d4a12 100644 --- a/Source/ModelGroups/Animation_Skin.cs +++ b/Source/ModelGroups/Animation_Skin.cs @@ -352,6 +352,7 @@ Runtime.Animation CreateFoldingAnimation(Runtime.Node jointRootNode, List { model.Camera = distantCamera; }), + // Removing this model for now, since no viewer currently supports models that have >4 jointweights per vertex. //CreateModel((properties, animations, nodes) => { // foreach (Runtime.Node node in Nodes.CreateFoldingPlaneSkin("skinF", 8, 9, vertexVerticalSpacingMultiplier: 0.5f)) // {