kcoley / gltf2usd

command-line utility for converting glTF 2.0 models to USD
MIT License
263 stars 39 forks source link

Is animated "stepped" frames / GIF / PNG possible in GLTF to USDZ? #51

Closed enzyme69 closed 5 years ago

enzyme69 commented 6 years ago

Like the subject, I am actually thinking to do some kind of stop motion animation using bunch of PNG + transparency. And having this as GLTF would be quite fun, I think.

Although so far, trying to do this using 3D mesh sequence seems like not possible since kefyraming visibility in block (not linear) or stepped keys do not translate to GLTF... unless I am doing it wrong? Wondering if Scaling On and Off in stepped keys would work ...

kcoley commented 6 years ago

@enzyme69 are you trying to do step animations in glTF, which would look more like a 3D stop motion? There is a sample model in the glTF-Asset-Generator that demos this: https://github.com/KhronosGroup/glTF-Asset-Generator/tree/master/Output/Animation_Node You can check out model 03.

Or are you wanting to use an animated sequence of images in glTF? If so, this isn't supported without a custom extension.

enzyme69 commented 6 years ago

Thanks, will try~

Yes that is right, this is 2 questions in one, wanting to do both:

enzyme69 commented 6 years ago

@kcoley It might be me not doing it properly, but I cannot get "stepped key" animation to work.

3 keyframed Cube Position that supposed to pop from position A, B, C become linear interpolation.

On your example however, it seems to work on browser.

Wondering if USD or USDZ allow this?

kcoley commented 6 years ago

@enzyme69 ah right, I have an upcoming fix in my refactor_skeleton branch which should handle animation interpolation baking. I'll try to get that ready tonight or tomorrow for you to test.

enzyme69 commented 6 years ago

USDZ_stepped.zip

I attached the Blend (open with Blender 2.79). It's a simply basic animation with "stepped keys".

The resulting animation is still interpolated as linear, eventhough the motion is really fast.

I am trying to recreate this: https://www.youtube.com/watch?v=6dsr8uXA5qE

enzyme69 commented 6 years ago

Note: Animation works in MacOS, but failing again on iOS 12 GM! 🤔

wave-electron commented 6 years ago

I fixed it, now works in IOS 12. Watch the jointname - has to the same as the Skeleton... remember you showed me that! rename the file to stepped.usdz to run. stepped.usdz.txt

wave-electron commented 6 years ago

@enzyme69 @kcoley @ox Another gotcha for making sure ios12 previewing doesn't fail. Always make sure you never assign more than one solid-color or material to a single mesh! This is why converting assets from SketchFab and other online sources is so problematic. This issue wasted hours of my time yesterday! I also found another really odd issue when you pair a bone animation mesh with a non animating mesh in the same model. Strange things are happening if the mesh is more complicated than say a cube mesh. I'm still trying to work out why this is happening... but it could be the reason some of these SketchFab assets have been so distorted after converting to usdz. Once I've finished testing I will post the files for reproducing.

enzyme69 commented 6 years ago

@wave-electron Thanks I realized I gotta keep the "/Armature/" in the hiearchy.

BEFORE:

screen shot 2018-09-14 at 8 06 13 am

AFTER:

screen shot 2018-09-14 at 8 05 58 am

Related to: https://github.com/kcoley/gltf2usd/issues/53

OK now back to the "stepped key stop motion case": So yes, the stepped seems to be interpolated, there is this weird pop. I will now research how GLTF handles stepped key properly.

enzyme69 commented 6 years ago

@wave-electron yes, Sketchfab assets are kind of "problematic". I did not find any GLTF animated asset that works 100% I guess it needs to be case by case until we reach a perfect result 😓

There seems to be no proper standard with GLTF ... Well, if I export my own animation from Blender using Khronos Group, at least I can say the pattern would be similar.

But a lot of artists uploaded just the BLEND or FBX file to Sketchfab and then Sketchfab automatically generate the GLTF. Sketchfab also auto convert FBX file to their own custom GLTF.

I am going to try my own character that is not a basic box or tentacle, and see how it goes!

kcoley commented 5 years ago

@enzyme69 @wave-electron I made some updates to the animation logic which allows some sketchfab models to animate. There is some twitching I am looking into. The other issue is the notion of attaching meshes to joint chains in glTF. I am not sure if/how that maps to USD yet, but looking into it.

I also updated my phone to the latest Beta (12.1) and was able to get animations to playback without the "skeleton root node trick"

wave-electron commented 5 years ago

@kcoley

Great work!.... Thanks for the update. Will try and test the new version out tomorrow & give you some feedback.

kcoley commented 5 years ago

Closing this for now