0
$\begingroup$

I'm working on a glTF, precisely I'm trying to animate a "static" mesh exported from Blender directly acting on its JSON. In doing so, I'm following the logic used in this tutorial , where a triangle is animated adding a new buffer, containing only data regarding time and rotation coordinates. Along with the new buffer, also the animations array, the bufferviews related to the new buffer, and the new accessors are added to animate the initial static triangle .

Right now, I'm trying to animate a plane, working on the input JSON obtained by simply creating the plane in Blender and exporting it in the glTF format. Using the same data URI seen in the previously mentioned tutorial regarding the rotating triangle:

{ "byteLength": 100, "uri": "data:application/octet-stream;base64,AAAAAAAAgD4AAAA/AABAPwAAgD8AAAAAAAAAAAAAAAAAAIA/AAAAAAAAAAD0/TQ/9P00PwAAAAAAAAAAAACAPwAAAAAAAAAAAAAAAPT9ND/0/TS/AAAAAAAAAAAAAAAAAACAPw==" }

I've been able to apply successfully that rotation to the plane .

The problem is that, always following the same logic, I'm having hard times in creating animations different from the one that is used in the tutorial so, basically I'm having problems in creating data URI containing information about time and animation. The procedure I'm using in creating those data URIs, consists of writing times and coordinates in a file saved with no extension (to have a generic binary data application/octet-stream) , and then converting this file in a data URI with an online converter .

Here you can see how I write the file to be converted in data URI that contains coordinates and time, and here you can see how the translation written in previous link doesn't work in the initial glTF of the plane. I suppose the error is the way i write the time and coordinates. How should I write those coordinates and time to be converted in data URI to be properly read and executed by the glTF?

I've even tried to separate time and coordinates by creating two different buffers, one referring to time and one referring to animation, to avoid the problem of making mistakes in setting the byteOffset property in the accessors referring to animation and time. Here you can see the code of a translation applied to the same plane using the two new buffers referring to time and translation.
The structure of the starting file, later converted in data URI, containing information regarding time follows:

(0.0),
(0.25),
(0.5),
(0.75),
(1.0)

The structure of the starting file, later converted in data URI, containing the translation coordinates follows:

{ 0.0, 0.0, 0.0 },
{ 2.0, 0.0, 0.0 },
{ 6.0, 0.0, 0.0 },
{ 6.0, 2.0, 0.0 },
{ 8.0, 4.0, 0.0 }

Thanks in advance for your help :)

$\endgroup$
2
  • 1
    $\begingroup$ "directly acting on its JSON" What does that mean? Blender doesn't have any JSON in it. GLTF is something that Blender exports. Do you mean that you want to export a series of meshes each containing the post-animation vertex data for a particular frame? That is, you want to convert Blender animation into vertex animation? This seems to be a question more about Blender3D than GLTF. $\endgroup$ Nov 17 at 15:21
  • $\begingroup$ As Nicol Bolas already mentioned, this question seems to be more about Blender. There is a StackExchange Community only for Blender (link). You might get a more detailed and faster response there. If you want to ask your question on this site, please read their help pages first and delete your question here since we want to avoid cross-site duplicates. $\endgroup$
    – wychmaster
    Nov 19 at 7:17

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.