SaschaWillems / Vulkan-glTF-PBR

Physical based rendering with Vulkan using glTF 2.0 models
MIT License
961 stars 130 forks source link

Warped animation importing from blender #23

Closed RisaStenr closed 5 years ago

RisaStenr commented 5 years ago

Hey i was playing around with this and tried to load a basic animation of a square. The model loaded correctly but the animation was incorrect, it rotated the square and increased its size where none of that was happening in blender (2.8), all I did was move the cube over a little bit.

Any tips on getting animations loading correctly?


Edit: Ok I fooled around a little more with this and imported the brainstem model from the official glTF sample models to see if exporting it again would produce any errors in the animation. It did not, so I also tried inserting plain location keyframes instead of locationrotationscale keyframes like I had been doing. This time the cube didn't move at all. Im hoping theres just some checkbox i need to check in Blender or something like that.

Peach1 commented 5 years ago

Post the glTF file on here so your specific example can be tested (try uploading the exported glTF and the .blend file in a zip) Also check that the exported glTF loads correctly in other viewers like: https://gltf-viewer.donmccurdy.com/

RisaStenr commented 5 years ago

Duh i should've included the files in my original post. anim.zip

I loaded it in the other viewer u linked and the animation was correct. I tried it again in Sascha's viewer and it was incorrect. Thats a handy little website there i'll bookmark that thanks for the link.

SaschaWillems commented 5 years ago

Thanks for the file. I'll check why this isn't displaying correct in my sample.

RisaStenr commented 5 years ago

Here's something else that may help. I made another animation, this time using only a translation keyframe, and while it displays correctly in the website viewer, in Sascha's sample it doesn't move at all.

The previous animation I posted used a translation rotation and scale keyframe.

transcube.zip

SaschaWillems commented 5 years ago

Looks like both files are using cubic splines for their keyframe animations. Right now my application only supports linear interpolation, that's why your models won't animate at all.

I'll have to read up on how this is done in glTF and take a shot at implementing it.

RisaStenr commented 5 years ago

Yup, that was it. Thanks so much for helping me out! Since you figured it out, I'll close the issue.