Help playing animations with glft file

Hi I need help. am to trying play the animations on my model linking to primitives and weights in its current format.

I have loaded it up on PG https://playground.babylonjs.com/#88CB6A#26.

In the old three.js GlftLoader and Draco.js prototype this was possible using the format but am really struggling to do anything with in babylon. my first thoughts was to read the file and create my own animation group? or ask the other developers to output multple scenes as I can somehow play them.

If someone clued up can you take a look and help me with possible options that would be great.

Any help would be appreciated as im struggling now

btw that is just a small test model, normally they will be the complete vehical. the test file (bonnet car) should crumple on animation.

the orignal prototype html file

Pinging @bghgary

1 Like

I’m not sure I understand what you are trying to do. I don’t see any animations in the PG or in the glTF. Are you trying to animate the meshes using Babylon (i.e. this isn’t a glTF question)? If so, does this help?

1 Like

If you download ( sAnim02_d_emb.html
into the browser you will see the model animate, not sure if it animating or just changing scene? would be good to understand that.

Can you tell how that is working without any animations…

appartently the html file summary is :

Create meshes with extra properties, one positions accessor and one texture mapping accessor per state. Viewer has code to read the extra data and cycle through the different states, building a GLTF object for each state using the corresponding data.

Yeah, I don’t know how to read this code. It looks like the glTF has custom vertex attributes that are being used somehow.

        "c0": 0,
        "c1": 1,
        "c2": 2,
        "c3": 3,
        "c4": 4,
        "c5": 5,
        "c6": 6,
        "c7": 7,
        "c8": 8,
        "c9": 9,
        "c10": 10,
        "c11": 11
1 Like

FYI, this is not a valid way to use glTF files. To add custom things to glTF, it must be in extensions or extras objects.

1 Like

thanks for the quick reply. it doesn’t seem valid GLFT as I’ve not been able to get any animations working, plus am unsure exactly how the format is doing it now but it works in those bundles so the client is like just do that, as it would require a change in code for the export. it seems a strange setup but its what am working with at the moment. I’ll try and find out more and come back.

I appreciate your reply :slight_smile:

If you look at the inspector in the PG link you sent, it shows a whole bunch of glTF validation errors.

image

You can click on the details link for the report. It looks like this file was possibly hand created or generated by a custom tool. The asset generator field is “Miles Thornton”?

Thanks yeah ive caught them but nothing really coming up on google relating to the invaild mesh primatives.Would the animiatons be coming from the bin file and the primiviates and weights link to them in there?

I should of deleted his name, gonna to check if he still works for Arup tomorrow

The invalid mesh attributes error just means that those attributes are not part of the glTF spec. glTF only supports a fixed list of vertex attributes as noted in this section of the spec.

Valid attribute semantic property names include POSITION , NORMAL , TANGENT , TEXCOORD_0 , TEXCOORD_1 , COLOR_0 , JOINTS_0 , and WEIGHTS_0 . Application-specific semantics must start with an underscore, e.g., _TEMPERATURE .

For application specific attributes, they need to start with _, but there still needs to be custom code to handle it.

1 Like

thanks that’s something i can go with tomorrow. i’ve try accessing the mesh attributes (primivities) on my scene render but couldnt see anything that was related. I was thinking maybe i need to read file as text then maybe do something with it. Any suggestions ? or things I can use from babylon framework to help me do that?
:slight_smile:

The glTF loader by default will drop vertex attributes that are not part of the standard. If you want to modify that behavior, you can read up on how to extend the glTF loader in Babylon.js. I’m not sure we have all the hooks necessary for you to do this, but let us know if you run into any issues and we can try to fix it.

thanks Gary for pointing me somewhere, I saw a few posts on the gLTF loader and tried it tho I didnt go too far into it so can revist them and use that guide.

:slight_smile:

1 Like

Am playing around with the default extentions now but havent found anything yet, even a custom one am ensure how it works yet. Another question would it be possible to place those vertex attributes in the mesh attributes on babylon load?

I think it’s useful if you can find out what the attributes do first.

The attributes are nodes that play the different scenes, those attributes indicate the index for each scene in the animation, via the accessors that link to the buffer views which pull the corresponding geodata from the bin file

What we are trying to do is recreate each scene with its own glb/glft, that allows us to change the primivites, is there a way we can cycle through the primrivates postion and textcord_0 values and change them on a loop? within a scene instead of creating multple scenes?

Sorry, I’m having trouble understanding the scenario.

What does node and scene mean in this context?

I don’t understand any of this. :frowning: Is it possible to explain with more details or maybe a playground?

This is what we’ve worked on today, somehow we have to re-engineer the glb as our (animations) are not animations they are primitives that link to different states that display the model’s different contour and position, we somehow need to re-render the scene to play the different positions and textacord_0.

Here is a up to date PG https://playground.babylonjs.com/#88CB6A#50, as you can see we can reconstruct the glb with the primitives for each scene then trying to append them(not sure if that is correct) then somehow try to render them in sequence.

Have you any suggestions on how we can render scenes using the different glb files that are created?

@bghgary hi do you have any time to look at my previous post ? any help would be great thank you

Why not simply enable/disable the meshes in sequence?

https://playground.babylonjs.com/#88CB6A#51

Regarding your gltf file, you could create 12 meshes in the file instead of 1 with custom attributes. That way, you would not need custom loading code.

2 Likes