2
$\begingroup$

I am trying to load gltf data onto an engine I am making and I am noticing that something is wrong with the rotations. I want to be able to see the raw numeric values of the animation data in the gltf source file to compare against what my code is constructing but I cannot find anything.

Gestaltor doesn't seem to show the actual data, and online viewers and validators just tell you if the data is malformed or not, they don't show it.

$\endgroup$

1 Answer 1

2
$\begingroup$

I help maintain an open-source extension for VSCode called glTF Tools.

Find the sampler for your animation. The input values will point to a list of times, and output will point to a list of values, likely quaternion values if this is rotation.

screenshot of sampler

In the above case, you might place the cursor on the 7 (the output accessor index), and press the hotkey F12 to find the definition of accessor index 7.

screenshot of accessor 7

Above, VSCode's JSON "Breadcrumbs" (the thin top row) are showing that the cursor has navigated to the accessor in question. Now we can ask VSCode to decode the raw data here with the glTF: Inspect Data command, by default bound to the hotkey ALT + D. Pressing this key should open the inspector.

screenshot of decoded data

Ah well, here you can see I've picked a very simple rotation with two fairly boring quaternion keyframe values. But if you have a more complicated list of rotation keyframes, the output here will be longer and more varied. You may right-click on a row to copy just the row's value, or copy the entire decoded data as plain text (for pasting into a spreadsheet or text file, for example).

The above method works for all kinds of glTF data beyond just animations. But there's another method specific to animations, two commands glTF: Import animation and glTF: Export animation. These attempt to pull the raw data directly into the JSON editor for editing, but the resulting file is not valid glTF during such edits. If you take this alternate route, remember to export the animation again when done editing.

Give the inspector a try first. Good luck!

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.