[x3d-public] JSHumanoids repo—resize, reanimate your humanoids
Joe D Williams
joedwil at earthlink.net
Thu Mar 7 15:13:09 PST 2024
The main purpose of the rescale excercize is to move the model drawn dimensions to 1:1, not the about 44:4444444444444:1 as in this Jinloa4 example. Of course the rotations are OK, it is the root translations that can produce animation problems.
The example uses a scale 0.0225 0.0225 0.0225 in the Humanoid node to put it in proper default size. If you use a 'standard' animation, the rotations are OK, but for inputs moving the model as applied to the root Joint then the translation (up.down, left, right) movements must be about x44.4444444444444 to get the expected result when moving the character in the default space.
This is a big reason we want the model to be drawn in default Humanoid space, same as default containing space, so we can use 'standard' animations designed for a 'standard' model. For example, in the Jin model, with the Humanoid node scale 0.0225, it takes a lot to get Jin to Jump.
Overall, it is much better, when possible, to present the user code as drawn in the default Humanoid space (1m = 1m) because the browser has to do that work anyway when it draws the thing.
In this example we just did the scale work for the joints and transforms and geometries the same way the browser would do, just multiply x and y and z by the scale factor, then remove the scale field from the Humanoid node. A slightly advanced version of this would allow the user to choose the final size (say 1.4m tall instead of 44.4444444444444m tall and scale the rest of the data for that target.
Note that another way that sometimes works is to just contain the Humanoid in a scaled Transform to get rid of the scale in Humanoid. But as always, if you wish to be in the same scene as other 'standard' models, the best solution is just to draw everything in default humanoid scale from the beginning.
Thanks to All,
Joe
-----Original Message-----
From: John Carlson <yottzumm at gmail.com>
Sent: Mar 7, 2024 12:08 PM
To: Carol McDonald <cemd2 at comcast.net>
Cc: Joe D Williams <joedwil at earthlink.net>, Katy Schildmeyer KS APPAREL DESIGN <katy at ksappareldesign.com>, X3D Graphics public mailing list <x3d-public at web3d.org>
Subject: Re: JSHumanoids repo—resize, reanimate your humanoids
Reorient should just change OrientationInterpolators, no changes to Humanoid figures. I am fairly dependent in which nodes I traverse right now hunting for interpolators, I can add more. DOM rescaling is not possible, because JinLOA4.x3d has a stack overflow which X3DJSAIL hides. Plus DOM is not really typesafe. In other words, I am not sure I do full traversal. Normally I handle interpolators at the top scene level.
Rescale should handle multiple meshes, I am unsure about how many types of geometries I handle. Make a request for a geometry node to be added. Mostly I’ve been doing IndexedFaceSets.
Note that rescaling just works on humanoids right now. Set your HAnimHumanoid scale attribute.
These are fairly dang simple operations. One can consider applying a generic transform, but I haven’t gotten there yet.
John
On Thu, Mar 7, 2024 at 10:08 AM Carol McDonald <cemd2 at comcast.net (mailto:cemd2 at comcast.net)> wrote:
But I don't always want to rescale. If the humanoids are different - let's say between toddlers and adults, I would want multiple meshes that have very different rigs and movements.
Carol
On 03/07/2024 3:48 AM PST John Carlson <yottzumm at gmail.com (mailto:yottzumm at gmail.com)> wrote:
https://github.com/coderextreme/JSHumanoids
Under Apache 2.0 license. There’s also an .x3d file from the humanoid archive—license is included. Parts derived from X3DUOM. Alternative X3DJSAIL jars included. Please also provide license for X3dToJson.xslt.
For applying transformations to an X3DJSAIL scenegraph, like rescaling Humanoids and changing OrientationInterpolators through the whole scenegraph. 3D Model is in X3DJSAIL-GraalJS, extending beyond limits of Java binding code size.
I’d like to thank Don Brutzman for X3DUOM, X3DJSAIL and X3dToJson.xslt (I can’t use CommandLine due to Java bug/stack overflow), Roy Walmsley for X3DUOM and X3D JSON Schema, the authors of JinLOA4.x3d, Java and JavaScript language developers, vim developers, Saxon developers, Python language developers and Git developers.
Rescaling takes a Humanoid with a scale field, and multiplies and adds the values down the humanoid hierarchy.
Reorientation currently negates the rotation, achieving a kind of satisfaction for converting +Z to -Z and vica versa for OrientationInterpolators. Negating any axis is also possible.
Thanks to Joe Williams for the inspiration, and to Andreas Plesch for showing it’s possible, and Katy and Carol for Gramps (not included).
If anyone wants a node-java version, let me know.
This might be a programming model for future WinterAndSpring work.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-public_web3d.org/attachments/20240307/f495d7f3/attachment.html>
More information about the x3d-public
mailing list