[x3d-public] ... argument for allowing containerFields in x3d.py is misleading, start with a valid example instead
Brutzman, Donald (Don) (CIV)
brutzman at nps.edu
Sun Oct 29 23:20:08 PDT 2023
1. Thanks for a good explanation Joe.
Preoccupation with containerField, which is unique to the X3D XML encoding,
is generally unnecessary for making sense and understanding an X3D scene
graph. As you explain here, the X3D Architecture nodes and fields are how
to make sense of an X3D scene graph.
Humanoid models get very complex very quickly. We must utilize and test our
validation tools to ensure that we can actually build good humanoid models.
Such rigor is necessary if we want good humanoid animations and possibly
even human medical records someday.
2. A Python program that uses x3d.py for creation of scenes only has
methods using the field names. There should never be a need to define a
containerField (in XML) for a field (in Python).
Thanks to Python typing and careful design, it is quite hard to create a
runnable program that produces an invalid scene graph. There are thousands
of examples online showing how to do this correctly.
* X3D Resources, Examples: Scene Archives for X3D
*
https://www.web3d.org/x3d/content/examples/X3dResources.html#Examples
Once an X3D model is created in Python, if there are indeed bugs in x3d.py
export to XML output, then such bugs can be demonstrated via examples (good
input python program producing bad output XML file) and subsequently fixed.
Am keen to fix demonstrated problems when time permits.
John, sorry but I am unable to repeat anything consistently using the
multilingual snippets you have provided below. Thus am not able to make
sensible changes to x3d.py library.
3. If I understand correctly, John, you are trying to create an HAnim
model using Python and output it as XML.
Suggestion: you might take one of the simplest HAnim examples (LOA 0 or a
stripped-down LOA 1) in .x3d, run the corresponding .py version from the
examples, and see that it works. Then use that python program to generate
an output .x3d file in XML encoding. If round tripping XML to Python and
then back again to XML does not match (i.e. when comparing original XML to
output XML), then voila you have isolated a conversion error. Starting with
a valid .x3d model is a good starting place that gives you high confidence
you have begun with a correct scene graph.
Am expecting that any such conversion error is most likely in the Python
x3d.py to XML .x3d export. Once a bug is repeatable, then any corrections
that I might make to x3d.py autogeneration are testable, and corrections
become possible.
No snippets please, rather am suggesting that a repeatable bug report for
this would be:
a. Original valid XML model as .x3d file,
b. Converted valid Python program, adding export to XML model,
c. Python program export to XML model as .x3d file, invalid and not
matching (a).
Perhaps the Templates for Diamond Man are good examples to explore in this
manner?
* X3D Example Archives: Humanoid Animation, Templates, Diamond Man LOA
0
*
https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Templates/Diamo
ndManLOA0Index.html
*
https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Templates/Diamo
ndManLOA0.html#humanoidHAnimHumanoidReport
============================================================================
=================================================
HAnimHumanoid hanim_humanoid skeleton holds X3D4 HAnim2
joints/segments/sites.
[key] jointname : segmentname ^ sitename
[nodes] HAnimJoint (2), : HAnimSegment (1), % HAnimDisplacer (0), $
HAnimMotion (0), ^ HAnimSite (1), @ skin nodes (0)
============================================================================
=================================================
HAnimHumanoid DEF='hanim_humanoid name='humanoid' loa='0'
skeleton
humanoid_root
sacroiliac : pelvis
^ HAnimHumanoid humanoid holds 1 HAnimSite node: site_view
============================================================================
=================================================
* X3D Example Archives: Humanoid Animation, Templates, Diamond Man LOA
1
*
https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Templates/Diamo
ndManLOA1Index.html
*
https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Templates/Diamo
ndManLOA1.html#humanoidHAnimHumanoidReport
============================================================================
=================================================
HAnimHumanoid hanim_humanoid skeleton holds X3D4 HAnim2
joints/segments/sites.
[key] jointname : segmentname ^ sitename
[nodes] HAnimJoint (20), : HAnimSegment (18), % HAnimDisplacer (0), $
HAnimMotion (0), ^ HAnimSite (53), @ skin nodes (0)
============================================================================
=================================================
HAnimHumanoid DEF='hanim_humanoid name='humanoid' loa='1'
skeleton
humanoid_root
sacroiliac : pelvis
| l_hip : l_thigh ^ l_knee_crease_pt, l_femoral_lateral_epicondyle_pt,
l_femoral_medial_epicondyle_pt
| | l_knee : l_calf
| | l_talocrural : l_talus ^ l_lateral_malleolus_pt,
l_medial_malleolus_pt, l_sphyrion_pt, l_calcaneus_posterior_pt
| | l_metatarsophalangeal_2 : l_tarsal_proximal_phalanx_2 ^
l_middistal_tip, l_metatarsal_phalanx_5_pt, l_metatarsal_phalanx_1_pt,
l_tarsal_distal_phalanx_2_pt
| r_hip : r_thigh ^ r_knee_crease_pt, r_femoral_lateral_epicondyle_pt,
r_femoral_medial_epicondyle_pt
| r_knee : r_calf
| r_talocrural : r_talus ^ r_lateral_malleolus_pt,
r_medial_malleolus_pt, r_sphyrion_pt, r_calcaneus_posterior_pt
| r_metatarsophalangeal_2 : r_tarsal_proximal_phalanx_2 ^
r_middistal_tip, r_metatarsal_phalanx_5_pt, r_metatarsal_phalanx_1_pt,
r_tarsal_distal_phalanx_2_pt
vl1 : l1
| l_shoulder : l_upperarm ^ l_humeral_lateral_epicondyle_pt
| | l_elbow : l_forearm ^ l_radial_styloid_pt, l_olecranon_pt,
l_humeral_medial_epicondyle_pt, l_radiale_pt
| | l_radiocarpal : l_carpal ^ l_hand_tip, l_metacarpal_phalanx_2_pt,
l_dactylion_pt, l_ulnar_styloid_pt, l_metacarpal_phalanx_5_pt
| r_shoulder : r_upperarm ^ r_humeral_lateral_epicondyle_pt
| | r_elbow : r_forearm ^ r_radial_styloid_pt, r_olecranon_pt,
r_humeral_medial_epicondyle_pt, r_radiale_pt
| | r_radiocarpal : r_carpal ^ r_hand_tip, r_metacarpal_phalanx_2_pt,
r_dactylion_pt, r_ulnar_styloid_pt, r_metacarpal_phalanx_5_pt
| vc4 : c4
vl5
skullbase : skull ^ skull_vertex_tip, sellion_pt, r_infraorbitale_pt,
l_infraorbitale_pt, supramenton_pt, r_tragion_pt, r_gonion_pt, l_tragion_pt,
l_gonion_pt, nuchale_pt
^ HAnimHumanoid humanoid holds 1 HAnimSite node: DiamondManLOA1_view
^ HAnimSegment l_thigh holds 3 HAnimSite nodes: l_knee_crease_pt,
l_femoral_lateral_epicondyle_pt, l_femoral_medial_epicondyle_pt
^ HAnimSegment l_talus holds 4 HAnimSite nodes: l_lateral_malleolus_pt,
l_medial_malleolus_pt, l_sphyrion_pt, l_calcaneus_posterior_pt
^ HAnimSegment l_tarsal_proximal_phalanx_2 holds 4 HAnimSite nodes:
l_middistal_tip, l_metatarsal_phalanx_5_pt, l_metatarsal_phalanx_1_pt,
l_tarsal_distal_phalanx_2_pt
^ HAnimSegment r_thigh holds 3 HAnimSite nodes: r_knee_crease_pt,
r_femoral_lateral_epicondyle_pt, r_femoral_medial_epicondyle_pt
^ HAnimSegment r_talus holds 4 HAnimSite nodes: r_lateral_malleolus_pt,
r_medial_malleolus_pt, r_sphyrion_pt, r_calcaneus_posterior_pt
^ HAnimSegment r_tarsal_proximal_phalanx_2 holds 4 HAnimSite nodes:
r_middistal_tip, r_metatarsal_phalanx_5_pt, r_metatarsal_phalanx_1_pt,
r_tarsal_distal_phalanx_2_pt
^ HAnimSegment l_upperarm holds 1 HAnimSite node:
l_humeral_lateral_epicondyle_pt
^ HAnimSegment l_forearm holds 4 HAnimSite nodes: l_radial_styloid_pt,
l_olecranon_pt, l_humeral_medial_epicondyle_pt, l_radiale_pt
^ HAnimSegment l_carpal holds 5 HAnimSite nodes: l_hand_tip,
l_metacarpal_phalanx_2_pt, l_dactylion_pt, l_ulnar_styloid_pt,
l_metacarpal_phalanx_5_pt
^ HAnimSegment r_upperarm holds 1 HAnimSite node:
r_humeral_lateral_epicondyle_pt
^ HAnimSegment r_forearm holds 4 HAnimSite nodes: r_radial_styloid_pt,
r_olecranon_pt, r_humeral_medial_epicondyle_pt, r_radiale_pt
^ HAnimSegment r_carpal holds 5 HAnimSite nodes: r_hand_tip,
r_metacarpal_phalanx_2_pt, r_dactylion_pt, r_ulnar_styloid_pt,
r_metacarpal_phalanx_5_pt
^ HAnimSegment skull holds 10 HAnimSite nodes: skull_vertex_tip, sellion_pt,
r_infraorbitale_pt, l_infraorbitale_pt, supramenton_pt, r_tragion_pt,
r_gonion_pt, l_tragion_pt, l_gonion_pt, nuchale_pt
============================================================================
=================================================
Definitely a worthwhile exploration, and not for the faint of heart!
Carefully simplifying the LOA1 model before exporting Python might help (and
X3D-Edit can support that).
Good hunting and good luck.
all the best, Don
--
Don Brutzman Naval Postgraduate School, Code USW/Br brutzman at nps.edu
Watkins 270, MOVES Institute, Monterey CA 93943-5000 USA +1.831.656.2149
X3D graphics, virtual worlds, navy robotics https://faculty.nps.edu/brutzman
From: x3d-public <x3d-public-bounces at web3d.org> On Behalf Of Joe D Williams
Sent: Saturday, October 28, 2023 12:15 PM
To: John Carlson <yottzumm at gmail.com>; X3D Graphics public mailing list
<x3d-public at web3d.org>
Subject: Re: [x3d-public] What are valid children of HAnimHumanoid.skin?
argument for allowing containerFields in x3d.py
> argument for allowing containerFields in x3d.py
I don't understand. If no container fields then not able to do all of x3d.
We had to use containerField for the admittedly rare instance where the
default is not true. These are cases where looking up the containerField in
schema is not enough.
Some are tricky, like skeleton where only the root Joint has to have the
containerField as skeleton.
skin contains a Shape which does not have children.
However we are investigating the idea of how to code LOD choices for skin.
I think we already know how to do that for that for Segment geometry.
Thanks,
Joe
-----Original Message-----
From: John Carlson <yottzumm at gmail.com <mailto:yottzumm at gmail.com> >
Sent: Oct 26, 2023 10:08 AM
To: Joe D Williams <joedwil at earthlink.net <mailto:joedwil at earthlink.net> >,
X3D Graphics public mailing list <x3d-public at web3d.org
<mailto:x3d-public at web3d.org> >
Subject: What are valid children of HAnimHumanoid.skin? argument for
allowing containerFields in x3d.py
From:
<https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-DIS/Part01
/components/hanim.html#HAnimHumanoid>
https://www.web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-1v4-DIS/Part01/
components/hanim.html#HAnimHumanoid
I see:
MFNode [in,out] skin [] [IndexedFaceSet,
IndexedFanSet, IndexedQuadSet, IndexedTriangleSet, IndexedTriangleStripSet]
And fromL
https://www.web3d.org/documents/specifications/19774/V2.0/Architecture/Objec
tInterfaces.html#Humanoid
sequence<Object> skin [] [indexed mesh objects
as defined by the representation]
But in actual practice, I see:
<Shape DEF='
<https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Skin/JoeKick.h
tml#Joe_Shape> Joe_Shape' containerField='skin'>
<Appearance DEF='
<https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Skin/JoeKick.h
tml#Joe_skin_Appearance> Joe_skin_Appearance'>
<Material DEF='
<https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Skin/JoeKick.h
tml#Joe_skin_Material> Joe_skin_Material' diffuseColor='0.3 0.3 0.6'
emissiveColor='0.3 0.3 0.6'/>
<ImageTexture DEF='
<https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Skin/JoeKick.h
tml#JoeSkinImageTexture> JoeSkinImageTexture'
url=' "JoeBodyTexture29.png
<https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Skin/JoeBodyTe
xture29.png> "
"https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Characters/Joe
BodyTexture29.png " ' />
<!-- ROUTE information for KickTextureTransform node: [
<https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Skin/JoeKick.h
tml#ROUTE_194> from SkinInterpolator.value_changed to rotation ] -->
<TextureTransform DEF='
<https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Skin/JoeKick.h
tml#KickTextureTransform> KickTextureTransform'/>
</Appearance>
From:
https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Skin/JoeKickInd
ex.html
And
skin [
DEF Joe_Shape Shape {
appearance DEF Joe_skin_Appearance Appearance {
material DEF Joe_skin_Material Material {
diffuseColor 0.3 0.3 0.6
emissiveColor 0.3 0.3 0.6
}
texture DEF JoeSkinImageTexture ImageTexture {
url [ "JoeBodyTexture29.png"
"https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Characters/Joe
BodyTexture29.png" ]
}
textureTransform DEF KickTextureTransform TextureTransform {
}
}
==================================================
So it would seem like Shapes with an Indexed geometry is what we're aiming
for in the standard as one of the possibly many children of the skin
container field (note the space).
That is all okay, AFAIAC, just extremely confusing when deciding where to
add containerFields in DOM documents.
For example, consider the below:
<HAnimJoint USE='hanim_l_carpal_distal_interphalangeal_4'/>
<HAnimJoint USE='hanim_l_metacarpophalangeal_3'/>
<HAnimJoint
USE='hanim_l_carpal_proximal_interphalangeal_3'/>
<HAnimJoint USE='hanim_l_carpal_distal_interphalangeal_3'/>
<HAnimJoint USE='hanim_l_metacarpophalangeal_2'/>
<HAnimJoint
USE='hanim_l_carpal_proximal_interphalangeal_2'/>
<HAnimJoint USE='hanim_l_carpal_distal_interphalangeal_2'/>
[ etc. ]
It may not be apparent, but X3DJSAIL complains about this. There's no
containerField='joints', right? But I'm generating this code using x3d.py
which doesn't allow me to list containerFields!
Grr! Here are some of the "brutzman" messages from X3DJSAI, which are
valid. I really want to assign joints as a containerField, so perhaps I
will just do it in X3DJSONLD.
[apply] [error] X3DLoaderDOM: Parent-child node relationship not found!
(parent HAnimHumanoid, child HAnimJoint, containerField='children') Please
report this problem to brutzman at nps.edu <mailto:brutzman at nps.edu>
[apply] [error] X3DLoaderDOM: Parent-child node relationship not found!
(parent HAnimHumanoid, child HAnimJoint, containerField='children') Please
report this problem to brutzman at nps.edu <mailto:brutzman at nps.edu>
[apply] [error] X3DLoaderDOM: Parent-child node relationship not found!
(parent HAnimHumanoid, child HAnimJoint, containerField='children') Please
report this problem to brutzman at nps.edu <mailto:brutzman at nps.edu>
[apply] [error] X3DLoaderDOM: Parent-child node relationship not found!
(parent HAnimHumanoid, child HAnimJoint, containerField='children') Please
report this problem to brutzman at nps.edu <mailto:brutzman at nps.edu>
[apply] [error] X3DLoaderDOM: Parent-child node relationship not found!
(parent HAnimHumanoid, child HAnimJoint, containerField='children') Please
report this problem to brutzman at nps.edu <mailto:brutzman at nps.edu>
[apply] [error] X3DLoaderDOM: Parent-child node relationship not found!
(parent HAnimHumanoid, child HAnimJoint, containerField='children') Please
report this problem to brutzman at nps.edu <mailto:brutzman at nps.edu>
[apply] [error] X3DLoaderDOM: Parent-child node relationship not found!
(parent HAnimHumanoid, child HAnimJoint, containerField='children') Please
report this problem to brutzman at nps.edu <mailto:brutzman at nps.edu>
[apply] [error] X3DLoaderDOM: Parent-child node relationship not found!
(parent HAnimHumanoid, child HAnimJoint, containerField='children') Please
report this problem to brutzman at nps.edu <mailto:brutzman at nps.edu>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20231030/4d1cb382/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: smime.p7s
Type: application/pkcs7-signature
Size: 5464 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20231030/4d1cb382/attachment-0001.p7s>
More information about the x3d-public
mailing list