KhronosGroup / glTF-Blender-IO

Blender glTF 2.0 importer and exporter
https://docs.blender.org/manual/en/latest/addons/import_export/scene_gltf2.html
Apache License 2.0
1.49k stars 317 forks source link

Exporting animation based on Ocean modifier doesn't work #1942

Closed borisghidaglia closed 1 year ago

borisghidaglia commented 1 year ago

Hello everyone,

First of all, I hope I'm raising this issue in the appropriate place. Second of all, thank you for your work on this Importer/Exporter 🙏

I'm a complete Blender beginner, so my vocabulary might not be very accurate. Also, this issue might even be a misunderstanding on my end. If it's the case, sorry for that.

Describe the bug An animation created using the ocean modifier doesn't get included in the binary when exporting to .glb.

To Reproduce

  1. Follow this very short youtube tutorial.
  2. Export to .glb (I tried several exporting options)
  3. Open a new project and import the .glb created above
  4. The animation does't work

Expected behavior Animation should work at step 4.

Screenshots Not useful in my opinion. Let me know if I'm wrong.

.blend file/ .gltf Not useful in my opinion. Let me know if I'm wrong.

Version

Thank you very much for your help and time. Don't hesitate to copy/paste links for me to read if you don't want to bother to elaborate.

PS: sorry for the edit, it was an unfortunate cmd+enter

julienduroure commented 1 year ago

Hello, Ocean Modifier is not something we can export. This is some internal modifier animation that can't be converted to TRS animation. SK animation could be used, but there is no way to get it from Blender (using baking or not)

Other exporters don't export it neither.

borisghidaglia commented 1 year ago

Hello @julienduroure,

Thank you very much for your answer !

Ocean Modifier is not something we can export.

Ok! Now I understand why I couldn't do it after all this time!

This is some internal modifier animation that can't be converted to TRS animation.

I looked up what TRS means. If it's indeed "translation, rotation, and scale", does it mean that the only animations that one can export from blender are the ones we can transpose to these kind of transformations ?

SK animation could be used, but there is no way to get it from Blender (using baking or not)

I'm sorry but I couldn't find what SK animations are. Do you mind elaborating ?

I am currently experimenting with 3D, and my end goal is to embed and animate a 3D object on a website (like this one from Stripe, which uses three.js, supporting some 3D models formats, including .glb and .gltf).

If you could point me in the right direction(s), I would very much appreciate it 🙏

julienduroure commented 1 year ago

glTF core specification can manage animation of:

Starting with animation from a modifier is maybe not the right way to start with 3D world :) You should start with object animation, shape keys animation, then armature animation.

borisghidaglia commented 1 year ago

I see, thanks !

But then if animations from modifiers are out of the equation, and if SK animations could be used to reproduce what I want but cannot be exported (if I understood correctly what you said above), then what would my options be ?

I would need something to let me create SK animations and export them to a format supported by a three.js loader, correct ? And this something cannot be Blender, if I'm still following you there, correct ?

Don't hesitate to tell me if I'm missing something 😊

julienduroure commented 1 year ago

No, SK animation can be exported to glTF, but the missing step is that modifier animation can't be converted to SK animation in Blender.

borisghidaglia commented 1 year ago

Oh ok! So you are saying I could reproduce this ocean animation using SK (in Blender, manually, not by "converting" them from a modifier animation) and then export the result to glTF with your exporter ?


Also, related to this issue, I would have loved having some sort of note or warning next to the Animation checkbox to know that not all animations can be exported (and maybe give some indications about this, just like you kindly did with me).

Of course maybe it's not relevant because I'm not representative of your targeted users, but I wanted write down the idea just in case.

Screenshot 2023-06-17 at 18 46 01
julienduroure commented 1 year ago

Hello, This maybe need to be rephrased to be more precise, but animation that can be exported are written in the documentation:

A glTF animation changes the transforms of objects or pose bones, or the values of shape keys

https://docs.blender.org/manual/en/3.6/addons/import_export/scene_gltf2.html#animations

borisghidaglia commented 1 year ago

Hello @julienduroure, sorry for the late reply.

Thank you for the doc link and excerpt 🙏

I'm not familiar with Blender Manual yet, so I didn't stumble upon it.

A glTF animation changes the transforms of objects or pose bones, or the values of shape keys

Taking into account what you taught me above, this sentence makes perfect sense.

I still think a small text or "hoverable" question mark on the side or below the Animation checkbox would have been useful to me, and thus could be useful to others in the future, but as I said before, you are the expert and I might not be representative of your targeted users.

Thank you for your help 🙌


SK animation can be exported to glTF, but the missing step is that modifier animation can't be converted to SK animation in Blender.

On a side note, in case someone tries to do what I was doing, I found an way to generate SK animations using Blender (at least for ocean modifier animations, I don't know if it works for every modifiers animations).

You can export your animated object to an .mdd file, using the NewTek MDD add-on. It has (from what I found) no documentation in the Blender Manual, but it is an officially supported Blender add-on (source: here in the add-on code and here, confirmed by a maintainer).

Finally, here is a youtube tutorial I found, demonstrating this. It is unfortunately in Korean and it is a youtube video, but the generated subtitles and the video with Blender in its english version are more than enough to follow.

If someone has a written and english related blog post or documentation, it would be awesome to share it for the people that will be looking for this in the future.

Also @julienduroure if this solution has limitations or if I'm wrong somewhere, don't hesitate to comment 🙏

julienduroure commented 1 year ago

Closing this ticket, as this is more a workflow/pipeline issue, more than specific to glTF. Feel free to open a new ticket if you encounter some glTF I/O issue!