[X3D-Ecosystem] Does this AI program generally look correct?
John Carlson
yottzumm at gmail.com
Tue Jan 21 13:32:27 PST 2025
On Tue, Jan 21, 2025 at 2:21 PM Joe D Williams <joedwil at earthlink.net>
wrote:
> > how to attach PivotConstraints to objects
>
>
>
> It is (must be) part of the blender object that works
>
> like Transform, having translation rotation and center
>
> and now, we know a little about the about the pivot.
>
Yes, all Blender objects (in the specific sense, not bones) have a set of
transform fields, either a matrix or matrices (for world and local
transform multiplication), and/or rotation (many forms), scale, and
location (translation) like X3D. That’s why you see so many Transforms on
output, because X3D separates objects (mesh, light, camera, text) from
transform information. I might be able to skip the Transforms for certain
types of objects, but what if the blender fields are non-default? It seems
safe to emit a basic Transform or Group in the default case, if it’s not
animated. But first, let’s try to get animations right.
Is it some number between 1 and 0 then blender
>
> picks how the bone geometry is actually positioned
>
> and the actual xyz value for x3d center?
>
The number between 0 and 1 is the normalized position on the bone between
head and tail. Think of head as a 0 and tail as 1. This is convenient
because it doesn’t set the vector of the bone, which AFAIK is tail minus
head. So head_tail is the percentage along the bone’s length that it
rotates around when head_tail > 0, otherwise, it rotates around the head.
The head is the same as the joint center.
>
>
> I got distracted before by the blender 'center' detail
>
> which turned out to be a bending point for a bone,
>
> with a similar constraint to set the the actual bending
>
> offset bone arc, I am guessing, of course.
>
>
>
> > I seem to have lost weight imports in the discussion
>
>
>
> index and weights they are with each blender bone data.set.
>
Yes, we currently have a vertex group for each bone. My question remains
whether the weight applies to the bone head in Blender, or the closest
point on the bone from the vertex. You and Michalis have assured me it’s
the bone head. It would seem to make sense to make the bone very short if
it’s the latter and X3D joint’s weights are relative to the joint center.
The vertex indexes and weights are loaded into Blender by looking at X3D
Joint fields.
I have no experience with bendy bones, I’m not sure if they have relevance
for X3D? Do they for glTF? Sound like a constraint?
Use for x3d parent Joint.index andweights.
>
I will try to continue to duplicate Gramps TimeSensor and ROUTEs on import,
instead of creating separate Blender actions. I think this may be a
solution which on ROUTEs which should have no real effect on animation,
hoping to eliminate possible stray ROUTEs not involved in animation, or put
them in another action/TimeSensor.
I also hope to work on specifying the right coordinate system for Vince and
Michalis’ .blend samples.
>
>
> Anyway, Best Luck,
>
> Joe
>
> .
>
> . .
>
>
>
>
>
>
>
>
>
> -----Original Message-----
> From: John Carlson <yottzumm at gmail.com>
> Sent: Jan 21, 2025 11:17 AM
> To: Joe D Williams <joedwil at earthlink.net>
> Cc: Michalis Kamburelis <michalis.kambi at gmail.com>, X3D Ecosystem public
> discussion <x3d-ecosystem at web3d.org>, Katy Schildmeyer KS APPAREL DESIGN <
> katy at ksappareldesign.com>, Vincent Marchetti <vmarchetti at kshell.com>,
> Carol McDonald <cemd2 at comcast.net>, GPU Group <gpugroup at gmail.com>
> Subject: Re: Does this AI program generally look correct?
>
>
> Blender bones can use PivotConstraint’s head_tail which is a value from 0
> to 1. So one chooses the bone head as a center of rotation by setting
> head_tail to 0. But the default is 0.
>
> Nothing’s changed except for we can now have a pivot point (X3D center)
> for Blender Objects (X3D Transform + mesh for example). So we can now
> Import and Export X3D Transform centers once the issue is acted on (I’m
> working on TimeSensors/Actions). If you want to use Blender objects for
> joints, that is possible. Please answer how to attach skin weights to
> Blender objects. Another approach is to provide one import for joint+skin
> only, and another for joint+segment+site+geometry. I think we have a
> better chance at getting the former working, and that’s what artists use.
> That’s what I’m going to focus on. I realize that multiple geometry skins
> are important.
>
> So yes, we can set X3D centers for non-bone objects in Blender using
> PivotConstraints, AFAIK. To set a joint center, one uses the bone head.
>
> I haven’t figured out how to attach PivotConstraints to objects yet, and
> bones don’t need PivotConstraints, unless you want to pivot around the bone
> center.
>
> The way you transfer a joint center to Blender is by setting the bone head
> (or head_local, I forget, look at how export gets it from the bone)
>
> It would be interesting to know if a bone can rotate around some point
> which isn’t on the bone. That seems like it might be possible.
>
>
> AFAICR, bone rotation imports have been working great for a long time.
> Now we have an opportunity to set pivots for Site and Segment geometry,
> which I hope will help out those imports. We still have an issue with
> exporting HAnimSites and HAnimSegments, especially for non-X3D blender
> models.
>
> Focusing on joint centers really got us nowhere with HAnim in blender.
> It’s easy to get bone rotations working. If people would understand that
> Blender bones have a head and a tail (a center, direction and length if you
> like) things would progress much faster. Bone head and tail can be in
> different locations in Blender, bones don’t have to meet at a joint, even
> when parented. head and tail are independent locations. Parenting a bone
> allowed it to be rotated with its parent.
>
> Meanwhile, I seem to have lost weight imports in the discussion.
>
> John
>
> On Tue, Jan 21, 2025 at 11:34 AM Joe D Williams <joedwil at earthlink.net>
> wrote:
>
>> > I found PivotConstraint by looking at the API based on what Joe told
>> me, not anything an AI told me, the AI was wrong. There was no
>> PivotConstraint in export or import so we were on new ground.
>>
>>
>>
>> So, in order to import/export 'standard' x3d humanoid to/from blender ,
>>
>> we need a blender transform matching an X3D Joint.
>>
>> with translation 0 0 0, rotation 0 0 1 0 and
>>
>> x3d Joint center equivalent to blender PivotConstraint
>>
>> ?
>>
>> Thanks, .
>>
>> Joe
>>
>>
>>
>> -----Original Message-----
>> From: Michalis Kamburelis <michalis.kambi at gmail.com>
>> Sent: Jan 20, 2025 10:32 PM
>> To: John Carlson <yottzumm at gmail.com>
>> Cc: Joe D Williams <joedwil at earthlink.net>, X3D Ecosystem public
>> discussion <x3d-ecosystem at web3d.org>, Katy Schildmeyer KS APPAREL DESIGN
>> <katy at ksappareldesign.com>, Vincent Marchetti <vmarchetti at kshell.com>,
>> Carol McDonald <cemd2 at comcast.net>, GPU Group <gpugroup at gmail.com>
>> Subject: Re: Does this AI program generally look correct?
>>
>>
>> John,
>>
>> My point was to suggest to you a better way, that will allow you to
>> achieve what you want *easier*, not *harder*.
>>
>> Your comparisons indicate that you find my suggestions (read the docs,
>> start with simple code snippets, use Blender as a regular user) harder, but
>> I still argue that your approach in this thread ("ask AI for a larger
>> solution and then wonder how/why the AI answer is wrong") is harder than
>> what I suggest.
>>
>> You don't need to run the marathon, read academic documents or do other
>> things perceived as "hard" that you mentioned.
>>
>> To recap / reformulate my 3 suggestions:
>>
>> - Trust Blender Python API docs (more than what AI tells you). You are
>> reading things, you are obviously reading emails and you're reading the AI
>> output, so I hope you will not have trouble reading the Blender Python API
>> docs. You naturally don't need to read it "from beginning to end" like a
>> book, just consult it as necessary. When you wonder about using X, look up
>> what X does, follow links from X to other classes and related methods --
>> Blender Python API docs are heavily inter-linked for this reason.
>>
>> - Try simplest code snippets in Blender. You mentioned yourself you like
>> code snippets, this aligns with my suggestion. Try to do simple things, 1
>> line, few lines, see if it does what you think, then build a bigger program
>> from these blocks. This *will* achieve a better outcome than asking AI to
>> come up with a bigger solution.
>>
>> - Do use Blender as a "regular user" and see in Blender's Python console
>> what your (interactive) actions translate to in Python. It's really easy.
>> You learn Python API this way. And you will then know what your users
>> (which are Blender users in this case) actually do.
>>
>> Regards,
>> Michalis
>>
>> pon., 20 sty 2025 o 22:11 John Carlson <yottzumm at gmail.com> napisał(a):
>>
>>> I’m not really sure what you’re saying Michalis. I’ve got working
>>> gramps export code, so it would seem the task is to do the opposite using
>>> similar API on import. I can stare at the API for ages. I found
>>> PivotConstraint by looking at the API based on what Joe told me, not
>>> anything an AI told me, the AI was wrong. There was no PivotConstraint in
>>> export or import so we were on new ground.
>>>
>>> No, I can’t consume large amounts of documents on the web, I mostly rely
>>> on code snippets. If I could read academic documents, I could probably
>>> have gotten a PhD or Masters. Back when I could read better, my professors
>>> invited me to get a higher degree.
>>>
>>> Please be considerate and realize there’s neurodiversity in what people
>>> can accomplish. Just because I can master the bash shell doesn’t mean I
>>> can use the Blender GUI or play a 3D game to my satisfaction. I do win
>>> world records regularly on Solitaire4us on Roku. I don’t expect people to
>>> learn vim. I recommend notepad or vs code. I did find this thing called
>>> vim3d which is very intriguing. I did try a “Blender” introductory game,
>>> but it was very short.
>>>
>>> Do I expect you to run a marathon or be a concert violinist?
>>>
>>> What I probably should do is grab the Blender source code so i can use
>>> bash tools to learn it. Weird why we didn’t figure that out a long time
>>> ago. That’s how I got as far as I did with CGE. I did look at Blender RNA
>>> a bit.
>>>
>>> UTSL!
>>>
>>> Ps:
>>>
>>> I recently found “grep -L”, should be really useful! I’ve been wanting
>>> that for quite a while!
>>>
>>> I have found AI useful for creating a prototype Python database
>>> filtering GUI, fun stuff and no coding needed except to load the database
>>> from X3D JSON. AI whipped out most of a naylib to Three.JS conversion as
>>> well, and the result looks better than my hand-coded stuff, probably due to
>>> API limitations.
>>>
>>> Just because people are in 3D graphics work doesn’t mean they like to be
>>> immersed in virtual 3D. My particular bent is mathematical visualization.
>>> I’m not seeing my surfaces in Blender yet, I still want to my surfaces into
>>> Blender, but that may mean extending X3D or Blender. I hired someone to
>>> get my surfaces into Blender, and they failed, despite having all my
>>> working X3D source code and shaders.
>>>
>>> John
>>>
>>> On Mon, Jan 20, 2025 at 3:51 AM Michalis Kamburelis <
>>> michalis.kambi at gmail.com> wrote:
>>>
>>>> Please don't rely on AI like this. Analyzing why AI said this, not
>>>> that, is often a waste of time, in my experience.
>>>>
>>>> AI is guessing. But you should not be guessing. You should:
>>>>
>>>> - Look at documentation, of everything related (Blender Python API in
>>>> general).
>>>>
>>>> - Walk step by step, testing snippets of code, from smaller (1-line) to
>>>> larger, making sure your code does what you want in each iteration.
>>>>
>>>> - Do the operations in Blender, looking in Blender's Python console
>>>> what your interactive operations translate to in Python. This is a great
>>>> way to learn Python API.
>>>>
>>>> To be clear, AI can be a big help with coding. I'm using it too. But
>>>> not like this. You will just waste time trying to analyze why AI is
>>>> guessing wrong ("hallucinating"), trying to find some "nuggets of truth" in
>>>> what AI tells you. Instead, rely on documentation and do own research.
>>>>
>>>> Basically, use AI to help you with *your own* solution. But don't just
>>>> "take a solution from AI" and don't waste time trying to analyze why AI
>>>> said something wrong.
>>>>
>>>> Regards,
>>>> Michalis
>>>>
>>>> pt., 17 sty 2025 o 18:45 John Carlson <yottzumm at gmail.com> napisał(a):
>>>>
>>>>> Looking at the screen capture some more, there’s tons of evidence that
>>>>> the file got loaded, then the X3D got imported, with no cleanup in-between.
>>>>>
>>>>> Just confirming my intuition.
>>>>>
>>>>> John
>>>>>
>>>>> On Fri, Jan 17, 2025 at 11:13 AM John Carlson <yottzumm at gmail.com>
>>>>> wrote:
>>>>>
>>>>>> It appears that import is messed up. There are 2 armatures with
>>>>>> gramps, when there's only one humanoid in the file. Weird! Looking at
>>>>>> gramps in castle, everything looks good except for lighting. I need to
>>>>>> look at import code a bit more.
>>>>>>
>>>>>> [image: image.png]
>>>>>>
>>>>>> I am unsure I am able to import more than one armature. There are
>>>>>> very strange errors happening, which I can't currently solve.
>>>>>>
>>>>>> John
>>>>>>
>>>>>> On Fri, Jan 17, 2025 at 9:44 AM John Carlson <yottzumm at gmail.com>
>>>>>> wrote:
>>>>>>
>>>>>>> That’s what I’ve been doing with Joe Kick for nearly a year now. I
>>>>>>> will try to import gramps and re-export to see what’s up, now that I am
>>>>>>> more confident with export. There could be an issue with interpolators on
>>>>>>> import, converting to NLA Tracks.
>>>>>>>
>>>>>>> Also, some of Vince and Michalis’ .blend models can use the same
>>>>>>> treatment.
>>>>>>>
>>>>>>> I hear you Joe, but you’re just confirming that I am doing things
>>>>>>> correctly. We just need to compare first export with second export. I
>>>>>>> don’t quite know what a Switch will do on import currently, should be
>>>>>>> interesting.
>>>>>>>
>>>>>>> I guess there might be some interpolators which are not connected to
>>>>>>> TimeSensors which could be getting included in the imported animation, but
>>>>>>> importing an export should clear that up.
>>>>>>>
>>>>>>> Hmmm. I wish my brain worked better.
>>>>>>>
>>>>>>> John
>>>>>>>
>>>>>>> On Fri, Jan 17, 2025 at 3:34 AM Joe D Williams <
>>>>>>> joedwil at earthlink.net> wrote:
>>>>>>>
>>>>>>>> Why not show what this produces.
>>>>>>>>
>>>>>>>> Does not look complete but form for Joint node looks correct
>>>>>>>>
>>>>>>>> with center and skinCoordIndex and skinCoordWeights.
>>>>>>>>
>>>>>>>> Thanks,
>>>>>>>>
>>>>>>>> Joe
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> -----Original Message-----
>>>>>>>> From: John Carlson <yottzumm at gmail.com>
>>>>>>>> Sent: Jan 16, 2025 10:42 PM
>>>>>>>> To: X3D Ecosystem public discussion <x3d-ecosystem at web3d.org>,
>>>>>>>> Katy Schildmeyer KS APPAREL DESIGN <katy at ksappareldesign.com>, Joe
>>>>>>>> D Williams <joedwil at earthlink.net>, Michalis Kamburelis <
>>>>>>>> michalis.kambi at gmail.com>, Vincent Marchetti <vmarchetti at kshell.com>,
>>>>>>>> Carol McDonald <cemd2 at comcast.net>, GPU Group <gpugroup at gmail.com>
>>>>>>>> Subject: Does this AI program generally look correct?
>>>>>>>>
>>>>>>>>
>>>>>>>> If we can agree that this generally looks ok, I will try to
>>>>>>>> implement this in the Blender importer:
>>>>>>>> https://claude.site/artifacts/7c4c15f2-1bde-4da5-9503-f4f25b09016a
>>>>>>>>
>>>>>>>> I realize the bone.tail should probably be the child joint center.
>>>>>>>>
>>>>>>>> I do not yet know what i am doing wrong, but my focus will be
>>>>>>>> shifting to animation import after export is done to my satisfaction.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://web3d.org/pipermail/x3d-ecosystem_web3d.org/attachments/20250121/184fd455/attachment-0001.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image.png
Type: image/png
Size: 234250 bytes
Desc: not available
URL: <http://web3d.org/pipermail/x3d-ecosystem_web3d.org/attachments/20250121/184fd455/attachment-0001.png>
More information about the X3D-Ecosystem
mailing list