[X3D-Ecosystem] [x3d-public] Tests for Blender->X3D exporter utilizing texture transformation and per-vertex colors

John Carlson yottzumm at gmail.com
Wed Jan 1 13:21:23 PST 2025


Joe has some good points.

Blender has start joint and end joint.  Aka: bone head and bone tail, which
I’ve been trying to talk about, but no one seems interested.

I can check how Transform center is handled in the importer, and how
Transform center is exported in the standard exporter.

The exporter has Transform center commented out.  Please double check my
work.

Transform center is handled on import:

def translateTransform(node, ancestry):
cent = node.getFieldAsFloatTuple('center', None, ancestry, conversion_scale) #
(0.0, 0.0, 0.0)
rot = node.getFieldAsFloatTuple('rotation', None, ancestry) # (0.0, 0.0,
1.0, 0.0)
sca = node.getFieldAsFloatTuple('scale', None, ancestry) # (1.0, 1.0, 1.0)
scaori = node.getFieldAsFloatTuple('scaleOrientation', None, ancestry) #
(0.0, 0.0, 1.0, 0.0)
tx = node.getFieldAsFloatTuple('translation', None, ancestry,
conversion_scale) # (0.0, 0.0, 0.0)
if cent:
cent_mat = Matrix.Translation(cent)
cent_imat = cent_mat.inverted()
else:
cent_mat = cent_imat = None
if rot:
rot_mat = translateRotation(rot)
else:
rot_mat = None
if sca:
sca_mat = translateScale(sca)
else:
sca_mat = None
if scaori:
scaori_mat = translateRotation(scaori)
scaori_imat = scaori_mat.inverted()
else:
scaori_mat = scaori_imat = None
if tx:
tx_mat = Matrix.Translation(tx)
else:
tx_mat = None
new_mat = Matrix()
mats = [tx_mat, cent_mat, rot_mat, scaori_mat, sca_mat, scaori_imat,
cent_imat]
for mtx in mats:
if mtx:
new_mat = new_mat @ mtx
return new_mat


joint/bone center is handled separately, which might be an issue.  I
believe joint/object center is handled as above.

So we have a problem that Transform center is not exported!

How we get anywhere with center not being maintained separately is beyond
my pay grade (I’m not paid to do C++, builds and distributions on multiple
platforms).  First steps might be getting a high powered mac and an apple
developer license ($100/year I think), then learn Xcode, etc at the same
time I’m learning Blender.  Meanwhile, other projects are languishing.

Joint transforms other than center are not currently handled, and animation
has position and orientation interpolators.

My suggestion is to nail down joint transforms (matrices and centers).  My
current approach is to turn joints into objects and bones.  I don’t handle
bone transforms yet.

John

On Wed, Jan 1, 2025 at 9:47 AM <joedwil at earthlink.net> wrote:

> > I wasn't talking about armature/bones (skeleton/joints) export or H-Anim
> when I mentioned above ...
>
> OK, just see that without being able to deal with the idea of a Joint
> transform 'center' then how does skeleton animation work?
> Also please notice that center is expected animation parameter in any x3d
> Transform.
>
> Thanks,
> Joe
>
>
> -----Original Message-----
> From: Michalis Kamburelis <michalis.kambi at gmail.com>
> Sent: Dec 29, 2024 4:33 PM
> To: <joedwil at earthlink.net>
> Cc: John Carlson <yottzumm at gmail.com>, Vincent Marchetti <
> vmarchetti at kshell.com>, <x3d-public at web3d.org>, <x3d-ecosystem at web3d.org>
> Subject: Re: [x3d-public] Tests for Blender->X3D exporter utilizing
> texture transformation and per-vertex colors
>
> > > (transforming Blender object's location/rotation/scale exported to X3D
> animating Transform.translation/rotation/scale would be my suggestions)
> >
> > First, Please recall that that the hanim import and export need
> transform,translation/rotation/center/scale
>
> I wasn't talking about armature/bones (skeleton/joints) export or
> H-Anim when I mentioned above. And I really don't want to go into a
> discussion about Blender armature system in this thread -- we're
> off-topic here already (this thread was intended about texture
> transforms) :) I already said what I intended in other thread --
> Blender is fully capable animation system used by artists for years in
> countless animations. I'm sure it can support whatever you need.
>
> In above cited phrase, I meant that a *first* step towards supporting
> animation export (in Blender -> X3D exporter) should be IMHO
> supporting animating Blender object's location/rotation/scale (without
> Armature/Bones, just set keyframes on these things in Blender).
> Because
>
> - This is what I would consider (and I think artists would agree) the
> most trivial possible animation method. No bones/joints, no
> skeleton/armature, some objects can just move/rotate/scale around.
> It's trivial, and it allows to express some things (like stuff flying
> around the world).
>
> - This trivial animation method is also simple to express in formats
> like X3D, glTF. Again, no need to deal with skin/joints.
>
> - And it is simplest for Python / X3D developers to support. No need
> to deal with skin, weights, joints. Start simple.
>
> Supporting animation using armature/bones (skeleton/joints) export /
> H-Anim is the next step. Let's first prove we can handle the basics.
>
> Regards,
> Michalis
>
> niedz., 29 gru 2024 o 22:42 napisał(a):
> >
> > > (transforming Blender object's location/rotation/scale exported to X3D
> animating
> > Transform.translation/rotation/scale would be my suggestions)
> >
> >
> >
> > First, Please recall that that the hanim import and export need
> transform,translation/rotation/center/scale
> >
> > All four, at least, not to mention scaleOrientation and any other x3d
> Transform fields.
> >
> >
> https://www.web3d.org/documents/specifications/19775-1/V4.0/Part01/components/grouping.html#Transform
> >
> >
> >
> > Joint has some added to std x3d Transform but it is just a special
> Transform with a couple of added fields..
> >
> >
> >
> > Next, please understand that the Blender so called Bone center is never
> the center of the bone.
> >
> > (hint: unless a bone is a cheerleader's baton),
> >
> > The field is coded and animated as the Joint center of the parent Joint
> as given by the bone begin default location.
> >
> >
> >
> > Yes, that is really how it works. At some point in the past Blender
> decided to expose the Transform center detail to the armature author using
> that empty Transform and illegal by x3d DEF/USE coding.
> >
> >
> >
> > So, with these two facts in hand we can actually think about exporting
> from blender true x3d hanim without the extra fake transforms that blender
> current api apparently needs to accomplish an hanim skeleton using Joint
> nodes rather than bones as the target authoring and animation interfaces.
> >
> >
> >
> > This leads to the, to me, obvious that blender should join the big
> leagues and evolve its archaic skeleton (armature) authoring interface so
> as to obsolete the "Bone" hierarchy and evolve to the Joint hierarchy.
> Might as well since under the covers that is how it actually works.
> >
> >
> >
> > Thanks for all the great work on blender x3d import/export and Best
> Regards,
> >
> > Joe
> >
> >
> >
> >
> >
> >
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-ecosystem_web3d.org/attachments/20250101/23a3b896/attachment-0001.html>


More information about the X3D-Ecosystem mailing list