[x3d-public] Add quaternion utility methods to X3D SFRotation programming-language standards?
Joe D Williams
joedwil at earthlink.net
Tue Jul 23 17:32:22 PDT 2024
> Joe, I have exported HAnim as glTF JSON.
I have not seen that. gltf has some 'standard' asset types and I was looking for that stuffs.
> I have also used the X3D blender importer and glTF exporter. We’ve gone over this.
Sorry I missed the result.
I have seen some simple examples of gltf assets that might be extended to handle hanim and sure they are logical but I still am wondering if it would be best to try and style some 'standard' gltf assets to look more like the special category of app that is of x3d hanim and skeleton-driven animations in general.
LOA1 does not show much animation. Is loa4 too many clicks, or what? Trim down the loa3 joekick skeleton to lower loa and you lose a lot but you could still hook up the skin by moving the skincoordindex and weights to remaining parent Joint. I still think best to have loa4 working then drop back to lower loa in steps. Whatever the owner, I still say start with loa4 and take the time to make all the measurements, then only animate the joints you need for your behavior choices.
> Examples without geometry and animation don’t help solving the animation issue, unless one is trying to solve Blender animation.
The best would be to transport easily between x3d and blender. I think blender will do all the x3d stuff like easein/out and maybe even animation using spline curves directly.
-----Original Message-----
From: John Carlson <yottzumm at gmail.com>
Sent: Jul 23, 2024 11:47 AM
To: Joe D Williams <joedwil at earthlink.net>
Cc: Andreas Plesch <andreasplesch at gmail.com>, Extensible 3D (X3D) Graphics public discussion <x3d-public at web3d.org>, GPU Group <gpugroup at gmail.com>, Johannes Behr <johannes.behr at threedy.io>, Subscribed <subscribed at noreply.github.com>, x3dom/x3dom <x3dom at noreply.github.com>
Subject: Re: [x3d-public] Add quaternion utility methods to X3D SFRotation programming-language standards?
Joe, I have exported HAnim as glTF JSON. That’s what the Gramps huff with alpha blend mode was all about. But the source wasn’t X3D, it was Katy. There’s probably many Blender exportable assets that can be rendered as glTF. Ask Doug.
I have also used the X3D blender importer and glTF exporter. We’ve gone over this. Please try the Blender import/export for yourself before assigning tasks. There’s an annoying thing where the conversion of the animation creates separate animations in blender export when viewing the glTF. AFAIK, glTF is not a runtime format, grouping animations is up to the code in addition to glTF (but I think that Michalis would take issue with this); I believe I saw glTF animations with auto start. There might be a Blender export option. Perhaps work needs to be done to improve HAnim animation import. Back to the BVH thing and animation concatenation, and efforts on the Blender loader. It will take extra effort to identify which animations to convert when all are provided. I believe I have an example with just one animation. Joe Kick is a great example. I had previously worked on roundtripping animation. I’m thinking any effort on glTF will produce individual animations for each joint. Playing the animations together is the key. X3D to X3D is half decent, with stray geometry. The animation of Jin in Blender itself is awful (Joe Kick has worked), but the loader had shown we can create animations that don’t revolve around the origin. There’s potential to ignore any Blender animation and go straight to glTF. If we have a runtime that can play numerous glTF animations at the same time, there might be further progress. But expecting me to click 146 animations to turn all of them on is a non-starter. Especially multiple times. If someone has Blender python code for grouped animations (I’ll do a search), fess up.
Examples without geometry and animation don’t help solving the animation issue, unless one is trying to solve Blender animation.
Again, a call for an LOA1 animation example. We can try without geometry. LOA4 is a time sink at this point. The tendency for me append LOA4 animation to LOA1 skeleton, and then write Java for cleanup.
If needed, i can provide compressed X3D JSON examples. I’m not convinced converting X3D to glTF is going to be smaller. Unreadable glTF formats, yes. Do we want unreadable formats?
I believe there are others working on X3D to glTF. Perhaps Blender is a stumbling block.
My tendency is to work on HAnim software any format can leverage.
Do you want some beliefware? That’s what I woke up to this morning.
John
On Tue, Jul 23, 2024 at 10:49 AM Joe D Williams <joedwil at earthlink.net (mailto:joedwil at earthlink.net)> wrote:
yes, this is a jsonized version of the xml and classic, though looking more like classic by showing container type string, almost like the wrapper tags, but still not having the mindset of the gltf asset composition.
Seems like the 'gltf' approach would break it up with an asset for the hierarchy and then maybe separately the geometry and another for the animations.
What I am looking for is, how to do a 'gltf' json encoding that follows some existing 'standard' asset types of json. Has anyone exported HAnim to json using the 'standard' json asset styles? I haven't but think those asset files would look lots different than what we see here.
The use case would be to compose and test using x3d user code, export to json gltf asset types for delivery. Another would be to import a jsonized hanim asset and convert to edit x3d hanim user code. Or just edit the json(?) with access to the hanim nodes and hierarchy (Joint, Segment, Site) to make it more relatable to HAnim.
So, I appreciate this transcoding to show that the json can certainly work to transport x3d hanim, but I don't see a direct use of it because it is no more compact or easier to read or edit than xml or classic. Finally, this does not really match the goals of the gltf, which is to deliver a compact set of assets aimed at runtime, not authortime.
some stuff from the metaverse (more x3d members should get involved with the metaverse forum.
Some past info from the forum dealing with gltf:
2023(ish) gltf development
physical materials
Tooling (usd <-> gltf)
Interactivity
Physics
Gltf Tools
Compression
iOS
Dampole Viewer
Asset Validator
Blender
gltf Extensions
specular anisotropy
WebP
GPU Instancing
meshopt compression
Physics
collision shapes
Rigid Bodies
Blender Importer/exporter
Overall, my impression is that gltf is still developing asset definitions for complex hierarchies like needed for hanim and for containing different types of animation data.
And what is a Blendshape?
To me, we just need to determine best practice for how x3d hanim user code gets gltfized using 'standard' asset types or if some extended more hanim looking assets need to be styled.
So, John and All, Great and very significant work showing the versatility of x3d.
Thanks Again and don't forget to suspend your disbelief ...
All Best,
Joe
-----Original Message-----
From: John Carlson <yottzumm at gmail.com (mailto:yottzumm at gmail.com)>
Sent: Jul 22, 2024 1:57 PM
To: Joe D Williams <joedwil at earthlink.net (mailto:joedwil at earthlink.net)>
Cc: Andreas Plesch <andreasplesch at gmail.com (mailto:andreasplesch at gmail.com)>, Extensible 3D (X3D) Graphics public discussion <x3d-public at web3d.org (mailto:x3d-public at web3d.org)>, Johannes Behr <johannes.behr at threedy.io (mailto:johannes.behr at threedy.io)>, Subscribed <subscribed at noreply.github.com (mailto:subscribed at noreply.github.com)>, x3dom/x3dom <x3dom at noreply.github.com (mailto:x3dom at noreply.github.com)>
Subject: Re: [x3d-public] Add quaternion utility methods to X3D SFRotation programming-language standards?
There are plenty of HAnim JSON examples if glTF wants to glom on!
See HumanoidAnimation in the X3D archives.
E.g.:
https://www.web3d.org/x3d/content/examples/HumanoidAnimation/Characters/JinLOA4.json
If you want JSON from X3D, there’s JSON button in X3D-Edit.
X3DJSAIL also offers conversion from XML to JSON.
As does Holger’s x3d-tidy! (use .x3dj).
Sunrize and X_ITE offer viewing of HAnim JSON.
John
On Mon, Jul 22, 2024 at 1:49 PM Joe D Williams <joedwil at earthlink.net (mailto:joedwil at earthlink.net)> wrote:
> My understanding is that there’s a desire to convert between axis-angle (SFRotation) and quaternions.
Please, when you think of legal gltf quaternion data, you must think of _unit_ quaternions.
This conversion is not a desire, simply that the gltf data and other transport forms use unit quaternions. Thus, if I understand, for example to export native x3d animation data to gltf we would need to convert, and to import we either need to convert to x3d native axis-angle or just use unit quaternions under the covers. But if we wanted to import for working with (editing/refining) the data, such as for orientation interpolators, would need to convert.
So, maybe like the SAI has 3x3 and 4x4 matrix operations, we need a way to convert a single or sequence of axis-angle to quaternion for export and the other way for import. I don't think it is useful to allow unit quaternions in x3d user code for rotations or orientations (just hard to work with handed editing) but it seems like it is unavoidable if we want import/export to gltf. Incidentally, the required gltf forms for skeletal hierarchies and animations are still being worked on by a metaverse forum group for interoperable assets.
Finally, looking at the gltf forms for skeleton transform hierarchies and animations, it seems like x3d should develop a set of hanim gltf assets specifically for hanim that use x3d hanim keywords and structures. From what I have seen, which is not much, the gltf useful for hanim content is very general and abstract to the point of not being directly relatable to hanim user code.
Thanks for some deep thoughts on this,
Joe
-----Original Message-----
From: Extensible 3D (X3D) Graphics public discussion <x3d-public at web3d.org (mailto:x3d-public at web3d.org)>
Sent: Jul 21, 2024 7:57 PM
To: Extensible 3D (X3D) Graphics public discussion <x3d-public at web3d.org (mailto:x3d-public at web3d.org)>
Cc: John Carlson <yottzumm at gmail.com (mailto:yottzumm at gmail.com)>, x3dom/x3dom <x3dom at noreply.github.com (mailto:x3dom at noreply.github.com)>, Subscribed <subscribed at noreply.github.com (mailto:subscribed at noreply.github.com)>, Johannes Behr <johannes.behr at threedy.io (mailto:johannes.behr at threedy.io)>, Andreas Plesch <andreasplesch at gmail.com (mailto:andreasplesch at gmail.com)>
Subject: Re: [x3d-public] Add quaternion utility methods to X3D SFRotation programming-language standards?
My understanding is that there’s a desire to convert between axis-angle (SFRotation) and quaternions. X3DOM has only supported quaternions in the past, looks like there’s progress! Cross-platform X3D is highly desirable.
Quaternion conversion might be useful to use in Blender export with X3DPSAIL (x3dv.py), but Blender provides utility libraries already, AFAIK. Mostly, I am setting rotations in OrientationInterpolators for HAnim and other animation. Rotations also come into play for orienting coordinate axes. I don’t see quaternions useful there.
For Blender import, working on importing animations for transform-like nodes should be paramount, especially in XML, and may require Blender modifications. If SFRotation methods can help with that, great. AFAIK, though, there’s no SFRotation class in the importer yet.
I stop here talking about quaternions. Begin rant. I’ll peek at the SAI WD now.
For X3DPSAIL, there’s more important considerations like automated DEF/USE (not for static scenegraphs, but for programs that generate many scenegraphs, with a wide variety of functions), X3D JSON export and integrating container field [ sic ] output in my mind. These should be priorities over quaternions. We both probably understand the pain of X3D JSON; the good news is, we have pretty reasonable stuff to move between that and XML or DOM. If someone tells me exactly how to read XML, JSON or VRML into an X3DPSAIL scenegraph, I will start looking at how to use X3DPSAIL for Blender import. One possibility is providing Python import to Blender! I totally understand that! Providing X3D to Blender Python conversions is critical for that. See: https://github.com/coderextreme/X3DJSONLD/blob/master/blend/localfinal.py for x3d blender python loader, which could be the start of a stylesheet.
Addition of standard vector/matrix multiplication/inversion operations to X3DJSAIL should be a priority over quaternions. I don’t know if standard matrix operations are part of SAI or not. Since we support matrix and vector fields in X3DJSAIL, operations on these seem obvious. If they are in SAI, X3DJSAIL was lacking as a couple of months ago. I used vecmath.jar. I’m as embarrassed as you are! I realize that’s not the purpose of X3DJSAIL. A pointer to the documentation doesn’t help here.
More priorities for X3DJSAIL: Comprehensive ways to select all instances of a given class in a scenegraph. Ways to filter on nodes with an attribute (DEF) present and value (ala HTML DOM and CSS), realizing libraries like JXPath exist (is there something better?). Convenience methods for removing nodes and statements in a set or two from the scenegraph would allow me to deprecate my code. Understood that this can probably be done with DOM. I may wish to load JavaScript into an X3DJSAIL scenegraph as subclasses of X3DJSAIL through class shims (see my X3Dautoclass.js files for graaljs).
Primarily, I am working on HAnim, and making large models feasible in X3DJSAIL Java and CGE’s x3d Pascal library (X3dToPascal.xslt?) would be nice! Promoting a fluent interface in SAI (setter and adder functions and methods that return a pointer or reference to primary object being worked on) would help with the latter.
Current Pascal generator:
https://github.com/coderextreme/X3DJSONLD/blob/master/src/main/node/PascalSerializer.js
These two HAnim .inc files have issues.
https://github.com/coderextreme/pascalsai/tree/main/code
If we had a pattern for breaking up a large Java code tree into separate methods , or lengthy Pascal code into “slices” or separate methods, cool. Maybe some online research would reveal something. Maybe we have an existing stylesheet, like the ROUTE visualizer? Hopefully, at some point, I will get some inspiration to solve this problem. It just seems like a command-line parameter that I haven’t looked up.
John
On Sun, Jul 21, 2024 at 5:01 PM Brutzman, Donald (Don) (CIV) via x3d-public <x3d-public at web3d.org (mailto:x3d-public at web3d.org)> wrote:
Interesting to see in the online issue discussion below that X3DOM includes quaternion methods.
The SFRotation representation has some similarity to quaternions, but they are of course mathematically distinct. Quaternions have long been a suggested alternative for X3D, with SFRotation remaining the primary representation since it is much more reviewable and editable (among other reasons). Nevertheless, for programmers, additional flexibility can be considered without conflict. This may encourage X3D API usage with other 3D programming libraries.
Please consider and advise whether quaternion-based accessor (get and set) utility methods ought to be added to the X3D specifications for SFRotation data type. Specifically they might become required in X3D Scene Access Interface (SAI), along with all of the future corresponding version 4.0 revisions to X3D programming-language bindings (ECMAScript/JavaScript, Java, C/C++/C#, Python).
* X3D Scene Access Interface (SAI), version 4.0 draft
* https://web3d.org/specifications/X3Dv4Draft/ISO-IEC19775-2v4.0-WD1
If so, please list what utility methods seem most broadly valuable. Based on responses, Dick and I will work on crafting a Mantis issue and draft specification prose for further review.
At that point, once reasonably well defined, am also willing to add convenience methods in Java X3DJSAIL and Python X3DPSAIL (x3d.py) libraries for testing. Contributions of exemplar source code for those libraries will also be welcome, if anyone wants.
Further interesting is the possibility that we are not only supporting future X3D programmers, but potentially also supporting Metaverse requirements for 3D Web Interoperability.
For those wanting additional background, more information about X3D data types and SFRotation (plus further links) can be found at
* X3D Tooltips 4.0: field types
* https://www.web3d.org/x3d/tooltips/X3dTooltips.html#type
* https://www.web3d.org/x3d/tooltips/X3dTooltips.html#FieldTypesTable
* https://www.web3d.org/x3d/tooltips/X3dTooltips.html#SFRotation
Thanks in advance for considering the possibilities and all feedback.
all the best, Don
--
Don Brutzman Naval Postgraduate School, Code USW/Br brutzman at nps.edu (mailto: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: Andreas Plesch <notifications at github.com (mailto:notifications at github.com)>
Sent: Wednesday, June 26, 2024 11:03 AM
To: x3dom/x3dom <x3dom at noreply.github.com (mailto:x3dom at noreply.github.com)>
Cc: Subscribed <subscribed at noreply.github.com (mailto:subscribed at noreply.github.com)>
Subject: Re: [x3dom/x3dom] SFMatrix4f() documentation for setRotation and translation (Issue #1322)
SFRotation field methods are also available but less well tested.
SAI code may look like this:
SFRot90 = x3dom.fields.SFRotation(1, 0, 0, 1.57);locR = SFRot90.multiVec(hitP);trans = new x3dom.fields.SFVec3f(440000, 3670000, 0);locT = locR.add(trans);—
Reply to this email directly, view it on GitHub (https://github.com/x3dom/x3dom/issues/1322#issuecomment-2192318975), or unsubscribe (https://github.com/notifications/unsubscribe-auth/AB23BYDQOLK25VKQG3TBTJ3ZJL65PAVCNFSM6AAAAABJRIL4AOVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOJSGMYTQOJXGU).
You are receiving this because you are subscribed to this thread.Message ID: <x3dom/x3dom/issues/1322/2192318975 at github.com (mailto:2192318975 at github.com)>
_______________________________________________
x3d-public mailing list
x3d-public at web3d.org (mailto:x3d-public at web3d.org)
http://web3d.org/mailman/listinfo/x3d-public_web3d.org
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20240724/add1f01a/attachment-0001.html>
More information about the x3d-public
mailing list