PDA

View Full Version : 3D models with animations



JernejL
15-08-2018, 02:13 PM
https://www.pascalgamedevelopment.com/showthread.php?32669-FBX-models-in-Delphi

There's some good question.. what do you people use to animate skeletal models in your games? i'm aware of glscene's smd support, but that's about it, what else is supported and availible, what do you use?

laggyluk
16-08-2018, 06:14 PM
Had same question few years back, didn't really find anything usable. In result I've dropped my pascal game coding and moved to Unity/UE4 :P

Ñuño Martínez
17-08-2018, 11:43 AM
I never used skeletal animation, but Castle Engine has skeletal support for both 3D and 2D. May be you should take a look.

JernejL
17-08-2018, 12:59 PM
I've spent a few days researching this, and have actually found quite a lot of support for skinned animations in pascal, but information is scarce and some of it is outdated.:



GLTF - another masterpiece by bero, i haven't checked this out yet, but it's actively developed and bero is known for his quality and complete work:
https://github.com/BeRo1985/pasgltf
https://github.com/KhronosGroup/glTF-Blender-Exporter

FBX & Collada

assimp ( collada: animations yes, fbx: animations yes (with some limitations regarding file version, if fails, try autodesk converter to change version, converter is here: https://www.autodesk.com/developer-network/platform-technologies/fbx-converter-archives ) )
https://github.com/assimp/assimp/blob/master/port/AssimpPascal/Readme.md ( a 2012 version but has 2016 updates, no clear information how to build a dll / so library, no examples )
https://github.com/assimp/assimp/wiki/The-asset-knowledge-base
has a model viewer: http://cms.assimp.org/index.php/viewer - it can help see if your files will work with your project

X3D (animations: yes), MD3, COLLADA (animations: ? ):
Castle engine: https://github.com/castle-engine - https://castle-engine.io/features.php#section_data / https://castle-engine.io/vrml_x3d.php
- from castle engine: https://castle-engine.io/view3dscene.php

File formats:
DCal3D "Cal3D" part of jedi - https://master.dl.sourceforge.net/project/jedi-sdl/OldFiles/JEDI-SDLv1.zip
loads DCal3D files (at least it claims to do so), but you will find it hard to find a good working blender or 3dsmax exporter.

half-life 2 smd:
tripledashgarlic: http://www.igrodel.ru/ - custom written animation loader, loads half-life 2 smd files.
glscene: https://sourceforge.net/p/glscene/code/HEAD/tree/branches/GLSceneLCL/ / https://sourceforge.net/p/glscene/code/HEAD/tree/branches/GLSceneLCL/Source/FileFormats/GLFileSMD.pas
glscene supposedly also has md5 support (verify claim that md5 is supported in glscene !! ):

totally custom:
3d studio max 7 script exporter to custom file format - complete implementation http://xproger.mentalx.org/export_anim.html


It seems like a pretty clear case that going for modern GLTF by bero would most likely work best for skeleton animation needs, assimp would be 2nd best choice (provided that library works, it has zero examples).

JernejL
27-08-2018, 12:16 PM
I have to add that bero's gltf loader has SIGNIFICANTLY progressed, and looks like ready for prime time use, it just lacks documentation and more examples:

https://www.youtube.com/watch?v=i8AOAUP8KsM

gerdich
28-08-2018, 07:18 PM
Wow! That's 100 times more than I was expecting. Where is the documentation? Can I use it with converted files from DazStudio, Poser, iClone, Unity3d ...? Is Ultimate Unwrap3D capable to convert? What about the zlib license and the limitations for commercial use? Does it worK with OSX, Android and iOS?

gerdich
28-08-2018, 08:21 PM
With Delphi Tokyo I get an Error "Assertion failed" in PasGlViewer.pas at line 1415
Assert(Status=GL_FRAMEBUFFER_COMPLETE);

JernejL
29-08-2018, 05:19 AM
Just open a ticket in bero's project, it's still work in progress, so he might break things from time to time.

As for gltf, i assume most popular packages can export it, if not - i know blender has a bunch of gltf exporters, you can also convert collada to it with a khronos group converter project.

Zlib license is no issue for commercial use: https://en.wikipedia.org/wiki/Zlib_License

ios and android: i don't know, ask bero :)

BeRo
29-08-2018, 07:13 AM
It's workarounded now, the current NVIDIA drivers have a issue in this context when a multisample FBO have a color-attachment-texture and depth-attachment-renderbuffer attached at the same time, so the workaround is now, that also the temporary depth buffer is also a fbo texture attachment now, so that it works also with the NVIDIA GPU driver again. (by the way, I've here in my test-hardware-set-setup: AMD Radeon 580, NVIDIA Geforce GTX 970, NVIDIA Geforce GTX 1060, NVIDIA Geforce MX150, Intel UHD 620, AMD Radeon R9 270X, and a lot of mobile devices with NVIDIA Tegra, Mali, PowerVR and Adreno GPUs, and so on, so that I can test my stuff against every relevant GPU vendor.)

gerdich
29-08-2018, 09:39 AM
Thank you BeRo for your reply and the very good job you did. My setup is very special. I see in your different setups also the name of many mobile GPUs. That makes me very curious!

BeRo
29-08-2018, 01:59 PM
And at http://vserver.rosseaux.net/stuff/paedaeloader/ and http://vserver.rosseaux.net/stuff/paedaeloader/SupraEngine.Models.DAE.pas you can find the sources for my feature-complete COLLADA .DAE loader (maybe with some missing but easily from yourself replaceable units).

But my pascal-native working FBX loader, as already said in an another thread here, I'll never release it, because FBX is super crappy and FBX simply has to die, because it is a super dreadful file format.

gerdich
29-08-2018, 04:36 PM
Which one have I to chose for animated models and few dependencies (more compatibility with mobile devices)?

BeRo
29-08-2018, 05:00 PM
Which one have I to chose for animated models and few dependencies (more compatibility with mobile devices)?

Very definitely GLTF 2.0, because it will simply become or already is the new open industry standard. See https://github.com/KhronosGroup/glTF/blob/master/README.md and you can convert COLLADA .DAE and .FBX files and other 3D file formats into GLTF 2.0 files (.GLTF/.GLB, where a .GLB file is a file with the GLTF JSON stub data together with a binary buffer overlay with the actual data as such as vertices, textures, and so on.) with (semi-)official tools.

More and more software will support GLTF 2.0. for example Windows 10 itself already has native GLTF support since about the Windows 10 3D Creators Major Update (and not only with their WMR VR thing, but also beyond it, for example, Windows 10 can open and show GLTF 2.0 3D models natively with the (at least at me) preinstalled Microsoft 3D Builder UWP app), and furthermore also available at Microsoft Office (at least PowerPoint) and so on. And Facebook also supports e.g. GLTF 3D models in the posts. and so on and so on and so on.

Either way, GLTF 2.0 will quickly become the dominant 3D file format, I guess.

JernejL
30-08-2018, 08:13 AM
Bero this is all really good news!

I've been (and probably others too) looking for animation capable file format + good pascal support for a really long time, GLTF promises a lot, and looks like really good to use.

I hope your loader & viewer progress further, i couldn't get it working with freepascal yet (not sure what the problem is, i reported it on github)

Can your gltf system use separate models for animating skeletons? like, have 1 gltf model to store all the different animations, and 10 other different models which are animated with those animations?

What about partial animations - playback more than 1 animation at a time (on separate bones - example aim animation + combining different straight + strafe walking animations ), and manual bone override / transform for IK + ragdoll? :)

I know it's a lot of questions but your work always gets me really excited, your projects are exactly what i need for my games / projects.

BeRo
30-08-2018, 12:31 PM
First of all, GLTF 1.0 is not compatible with GLTF 2.0, so don't try to load GLTF 1.0 models with PasGLTF, but really only GLTF 2.0 models, like with the other GLTF loaders from the C/C++ ecosystem also now as well, GLTF 1.0 is simply obsolete now, since GLTF 2.0 exists. At least my (now fixed) PasGLTFViewer FPC build has no problems to load GLTF 2.0 models, so I guess, that you tried to load a GLTF 1.0 model and not a GLTF 2.0 one.

PasGLTF is already completely GLTF 2.0 base-spec-core feature-complete, minus non-spec-core extensions such as the Draco compression extension, in other words, the current further work is only tidying up, optimizing and refining work.

And the UnitGLTFOpenGL.pas is just only a code template, that means, you yourself must adapt this code template unit to your own needs (for example for multiple animations at the same time) and to your own engine, because a really-universal-requirements loader would be either too overkill or almost impossible, because each engine and application purpose has its own data structures and design concepts, so that the UnitGLTFOpenGL.pas is really just only a code template and not a unit for real use. Only the acutal PasGLTF.pas GLTF 2.0 loader&writer unit is intended for productive use. :)

JernejL
01-09-2018, 11:25 AM
I did try it with what i assumed were fltf 2.0 sample files from their github repository, i did a checkout of https://github.com/KhronosGroup/glTF-Sample-Models/tree/master/2.0 this time, updated my repo again, recompiled it in lazarus and it loads the models fine - no issues whatsoever! it works great - no complaints - the project is really amazing.

What i was thinking regarding animations is mostly that most of games need some kind of "animation mixer", people who are like me that are 3d-art-impaired and not capable of creating animations :) we need to get creative on how we get and combine animations.

I'll follow the suggestion to build up on this template, i hope to have more successes to post here :)

You did something really amazing for us in pascal gamedev community with gltf project, i hope you know that, and althru there's very few of us, we really appreciate this.