Marketplace: https://marketplace.yoyogames.com/assets/7014/beta-mmk-animated-blender2gm Price: $179.99 introductory price which will increase to $299.99 later (Price may increase as updates come out) Available on itch.io, with an extra demo and alternate price! Basic Setup and Usage (Video) Video Demos Spoiler A full test in a 3D platformer implementation [latest video]: https://cartrdge.com/maddemichael/2018-big-gif-a-showcase-of-some-fancier-3d-stuff-i-ve-done A test in a networked 3D game - features binding other meshes to bones and multi-mesh armatures, as well as a familiar looking rocketship: https://cartrdge.com/maddemichael/3rd-person-version-of-the-client-server-test System used in this heat distortion demo: https://cartrdge.com/maddemichael/2018-heat-distortion-effect-bubbles-too A slightly improved early demo: https://cartrdge.com/maddemichael/cancelled-model-converter-for-gamemaker-gui Incredibly early test from when it first worked: https://cartrdge.com/maddemichael/3d-anim-lerp-in-gamemaker (yep, all of these are GameMaker! And they're gone because Cartrdge is gone. Now I'm sad. A good reminder to self-host, I suppose) I'll probably add more screenshots and gifs soon. Quick Function Reference Spoiler THIS IS NOW IN THE NOTES INCLUDED WITH THE EXTENSION!! [/code] Bugs? Questions? Suggestions? Reply to this post and I'll see what I can do! CHANGELOG (v0.4.0) Spoiler: Changelog Collisions. Uses an octree system to keep stuff fast Includes an export script for Blender Has support for ellipse and ray collisions. Also includes the ability to "cast" an ellipse in a direction Includes a super simple movement function to make it very easy to set up Functions to enable the use of "Pose Caching" - MMK_armature_set_matrix_output_array() MMK_animation_get_framecount(anim, adjust_for_gamespeed) Fixed another axis-angle issue (when not using native) When using native mode, a check is done GML-side to determine if an armature update is needed now. This was already done within the extension, but the call overhead was still apparantly eating up speed in YYC. Has little impact generally, but yields a very nice performance boost (I got a ~20% boost in the test project) for YYC when an armature hasn't changed pose and/or when using pose caching. (No real impact on VM at all though) A few fixes and additions relating to armature transforms. Fixe an export crash for when tangent export is active but the current mesh has no active UV map (zero values are added instead for now) Added an export option to automatically export armatures linked with the current selection. Enabled by default. Optimised a bunch of native code, fixed a different axis-angle issue within the DLL Initial itch.io release! Yay! New mascot and demo! Added new export scripts for Blender 2.8 Added better armature-mesh linking to the 2.8 export script, so now they don't need to have parent-child relationships, just the modifier. Extended the material system so now materials can manage GPU states individually and be ignored during certain render passes (the macro "MMK_auto_handle_gpu_resets" in MMK_models can be set to 0 to disable this). This allows materials to control whether or now they write to the zbuffer, for example. Note that global GPU states are still maintained, only those set will change. Fixed bugs with the material system not always being called when there is no shader change, causing visual defects in some cases Defined some undefined behaviour regarding passing bones to a shader Fixed a crash with "MMK_bone_get_transform" (forgot to comment out an unused argument) Added and improved armature mesh setting options, so now order can be better defined, as well as the option to check what meshes are enabled Added "MMK_armature_add_meshes" and "MMK_armature_set_meshes", which accept both individual meshes and mesh arrays, to streamline adding many meshes to an armature. Note that meshes are appended and set in order. Fixed default armature textures and materials not always being used as a fallback in cases where they should have Added the option to pass custom UVs to armature textures, in case you need custom ones. This can also be useful if you change a texture frequently, as it removes automatic uv_clipspace calculations. Made negative or < frame_1 animation setting use the first frame, which fixed an issue I believe was related to a floating point error preventing me from setting frame 0 of my test characters idle animation. Added some "advanced" output-matrix fetching functions, but I implemented them for reasons that don't work because I forgot, but they may be useful down the line. Default shaders now use blendweights and blendindices for GLSL ES as well, due to changes in how GameMaker passes inputs to attributes. I believe now names matter less, but the order of attributes is incredibly important Native/GML code parity maintained. Older versions Spoiler: Older v0.3.3 Scene Update A tiny fix for pointlights in the diffuse shader Object animations now seem to be correct for both right-handed and left-handed export (note that, for consistency with appearance in Blender, Apply Transforms must be disabled or the targets anchor point should be at O) [This is an update to the export script only] Right-Handed euler rotations for bones have been tweaked. Now they seem correct [This is an update to the export script only] Axis-Angle rotations remain untested MMK_JsonSceneExporter - A GameMaker-compatible JSON scene exporter for Blender, giving it the capability of being a level editor for GameMaker. Exports useful data like object transforms, names, types, and a lot of specific data for things like lights, cameras and more. (You may want to encode the output if you don't want people meddling with your scenes though) MMK_load_scene(file) - Used to load the new JSON scenes. Returns scene index. Remove scenes you're done with using ds_map_destroy() MMK_scene_generate_lighting(scene) - Resets and loads in lighting from the scene into GameMaker's built-in lighting system MMK_scene_generate_instances(map, ob_map) - Generate instances based on the "base_name" of an object in a scene (the name before the first dot - so "Object.003" would be just "Object") - and ob_map is a ds_map of base names to instance IDs. Basic for now, but still useful MMK_object_create_defaults() - Generate default variables used by 3D objects loaded by scenes MMK_matrix_object_local - A macro for generating a matrix for the current object using variables created from MMK_object_create_defaults() or from MMK_scene_generate_instances(), assuming rotations are YXZ MMK_matrix_object_world - A macro for generating a matrix fot the current object, with respect for transforms inherited from parents. This does weirdness if "Export Transforms as Local" is disabled (though I think I can fix this) MMK_object_get_world_matrix(instance) - A function that does the same thing as the above macro, but allows targeting a specific instance. MMK_scene_get_main_camera(scene) MMK_scene_camera_get_lookat(scene_cam) MMK_scene_camera_get_proj(scene_cam, view_index) MMK_is_drawing_armature - a macro that returns true if an armature is currently being drawn. Useful for materials that can work with and without armatures. MMK_current_armature - a macro that stores the current armature being drawn (only valid in materials - check "MMK_is_drawing_armature" first) MMK_current_vbuffer - a macro that stores the ID of the current vbuffer being rendered by the armature (only valid in armature materials) MMK_current_bonedata - a macro that stores an array of bonedata normally automatically passed to the shader (only valid in armature materials) MMK_material_full_update - a macro which replaces the old argument to make non-armature materials easier to work with. Included materials have been updated to reflect this change. This defaults to "true" outside of armature drawing to make static-compatible materials simpler to produce The macros are NOT read-only, but if you change them, please remember to reset them after you need them with MMK_reset_model_macros(); MMK_matrix_inverse() and MMK_matrix_transpose() - Added until YYG add native versions, useful for materials that need to generate a normal-matrix Renamed python scripts and put them in a group. Also stopped them being included in export by default Updated the function reference in the notes. Moved blend-info to the end of meshes to make them more compatible with other shaders MMK_begin_3D() - A super simple function that just sets up basic 3D state stuff. Material script arguments have been updated for single argument materials - they are now passed directly instead of in an array. Added a new demo material: MMK_material_outline_unlit(outline_size). A simple unlit shader that uses vertex-based outlining using normals. This is primarily to demo the new macros Also added "MMK_material_outline_diffuse(outline_size)", which is functionally the same as the above material, but uses diffuse lighting. Also shows how materials can be combined in certain cases. It is likely I'll add more scene functions in the future, including 3D path generation v0.2.3 Micro-Patch Tweaked the export script to allow appending ".MaterialName" to even single material meshes to make dynamic material assignment consistently possible. An option to disable this behaviour has also been added v0.2.1 Fixed a nativemode bug with updating child bones when they were not changed directly Added MMK_armature_bone_get_inverse_bind_matrix(arm, boneID) Added MMK_armature_get_matrix_output_array(arm) Added MMK_armature_bone_inherit_parent_transform(armature, bone, enable) - this makes the target bone and all children use the same matrix as the first bones parent. This is primarily for animation LODs as it saves time calculating and updating matrices, but does stop the results of MMK_armature_bone_get_matrix for this bone and its descendants from updating correctly until transform inheritance is disabled again. This cannot be applied to root bones. Added MMK_armature_bone_get_child_ids(arm, boneID) - returns either -1 if a bone has no children, otherwise, an array of child IDs. Added MMK_armature_bone_get_parent_id(arm, boneID) Added the quick function reference to the "Notes" of the extension Fix for importing models with trailing empty data in the buffer. Now shows an error in the console and stops reading any additional data. This was not a problem if you loaded the file directly. Models using the old version of the script need to be re-exported. Tweaked the export script to add a terminating value to the end of the data block to reduce the risk of the above error message being shown when not necessary. Also adjusted read values in general for a little bit of extra safety Tidied up the export options and labelling - MMK mode is default now, redundant or incompatible options are hidden and handy labels are shown with info about the export The export script is now capable of exporting material indices for both Static and MMK mode. Cool! This is either added as a 3rd entry to texcoord if UVs are exported, otherwise it's added as a single float texcoord to the end of the vertex format (after tangent data). The exporter has the option to split meshes by material when in MMK mode. ".MaterialName" is appended to the split mesh names - this disables the option of exporting material indices as vertex data as it would be redundant The importer and exporter handle missing or empty meshes better and their assosiation with armatures Added a simple fragment-shader diffuse material that uses the built-in lighting system (MMK_material_diffuse). A blinn-phong variant will be added soon™ Added safety to MMK_armature_draw just in case the shader a material uses changes within the same draw call. v0.2.0 Added native support for Windows, yielding performance boosts of up to 125% Fixed a bug that meant axis-angle animation keyframes were never applied. Tweaked the way initial keyframes are handled when animations are blended but only apply to certain bones each. Added a template material script (MMK_demo_material - uses the default shader but just provides a base to build from) v0.1.3 Initial release UPCOMING (v0.?.X) Spoiler: Upcoming Morph Targets/Blend Shapes Multiple UV maps per mesh Platformer Demo What is MaddeModelKit? MaddeModelKit (or MMK for short) is my personal animation system that allows me to export fully animated and rigged models from Blender and load them directly into GameMaker Studio 2. Because apparently I missed the memo that GMS2 is a 2D game engine It supports multiple animations, meshes and armatures in a single file, with keyframe interpolation and even the option to blend between multiple animations to smooth transitions. I posted a few screenshots over the last few years and it gained a little bit of interest, so I figured I'd tidy it up, optimise and release it! If you want to get into 3D with GMS2 but aren't sure where to get started, check out my guide on that (Demo Project Included): https://forum.yoyogames.com/index.p...arted-with-3d-in-gms2-project-download.12145/ I also have a free static model export script available too (Now with Tangent Support!): https://marketplace.yoyogames.com/assets/5839/export-3d-blendertogm Main Features No interim converter programs - just export the model and use it! This makes iteration and testing very simple and fast About as cross-platform as GameMaker itself Very simple to use - you can set up and animate a model within about 10 minutes! (As seen in the setup guide) Names used in the system are the same as those used in Blender to make it easy to get the right information. Exports animations from actions made in Blender - both armature and object animations supported! Animations and meshes can be applied from separate model files Support for location, scale and rotation (quaternion, YXZ euler and axis-angle) keyframes Blender Export supports: Position, Normals, Colors, UVs, Tangents/Bitangents (or binormals, depending on who you ask), Blend Weights/Indices and material indices (It can also split meshes by material) A fairly simple material system using scripts+shader combos, which can be assigned to armature instances Default shaders to drive the models - they even include a UV correction system so you can use any sprite straight away (No separate texture page required!) A scene exporter to enable using Blender as a level editor A native extension to speed up animation of armatures on certain platforms All functions and globals are prepended with MMK_ to reduce risk of name collisions You can manually assign or add extra transforms to bones to allow cool effects suchas making a character look towards a target dynamically. This has minimal cost due to how the system works internally I've tested it working on Windows, Mac, iOS and Android, both VM and YYC. Unfortunately, HTML5 isn't working quite right (see bug: https://bugs.yoyogames.com/view.php?id=28850) UPDATE: GameMaker Bug is fixed, but HTML5 is still bad and I haven't got it working yet. Why BETA?Although the system is technically feature-complete (It does everything I need it to), there's room for improvement and, like all things, probably has a bunch of bugs I just haven't noticed. It also gives me a good reason to actually get the system finished. There's also a few other features I might like to add, but I'm not sure yet. Included Stuff Shaders MMK_ES_skin/MMK_HLSL_skin - a pair of base shaders that skin and texture a model. Use these as a base for custom materials. MMK_ES_skin is required as the system uses it as a default fallback MMK_ES_skin_diffuse_PS - A pixel-shader diffuse shader used by the material MMK_ES_skin_outline - A shader that displaces vertices by their normals and makes the colour black. May be updated to allow colour choosing. Scripts MMK_demo_material - A simple demo material to use as a base for custom materials MMK_material_diffuse - A simple pixel-shader bsaed diffuse lighting material using GameMaker's built-in lighting system MMK_material_outline_unlit(outline_size) - A simple outine material MMK_material_outline_diffuse(outline_size) - A simple outine material that uses simple diffuse lighting Extensions MaddeModelKit - Contains all the GML and Native functions needed to run the system Included FIles MMK_AdvancedModelExport_VX_X_X.py - Install this into Blender to enable export of animated ".mmod" files MMK_JsonSceneExporte_vXXX.py - Install this into Blender to enable the export of JSON scene files. Notes A quick function reference MaterialsI decided to add a kind of "material" system to make the assigning and updating of shaders per mesh much simpler. It's not quite the same as a material you'd see in Unreal or Unity as it uses a GML script-Shader combo, but it's still pretty useful. I encourage users of MMK to make compatible custom materials and shaders and share them! The more of them available, the more accessible MMK becomes to other GameMaker users. You're free to use the included demo shaders and material scripts as a base. As of 0.4.X, materials can even manage GPU states and skip rendering completely, making them much more powerful. I plan to release a few compatible material packs as MMK nears completion myself. If you have made a compatible material, let me know as I want to link to it via a list that will be here. Possible Upcoming stuff Spoiler: Upcoming Short Version: v0.3.X - The Scene Update Done v0.4.X - The Collision Update v0.5.X - The Particle Update - I'm conflicted here. I made a system that works, but theSnidr's looks way better, so I might skip it. v0.6.X - The Skybox Integration (small, but handy) v0.7.X - To-Be-Determined, but I'm sure there's something... v0.8.X - A bunch of bug fixes and safety probably v0.9.X - The Full Native Update - Finally integrate native-mode on all viable platforms v1.0.X - At this point, the system will likely be complete. New updates are optional, but still a possibility 3D path tools will be added at some point, just not sure when in the timeline. More Detailed Version Full written documentation and function reference. Video tutorials and a simple "Making a 3D game in GMS2 with MMK" series Bugfixes galore. Native Extensions for: OSX, Linux, Android, iOS A kind of blendshape generator (this won't be a main feature, but a nice extra if it works) Per-keyframe interpolation modes instead of global - this is gonna take a bit of a rework of the GML code (less so of the native stuff) so it might be a while. UPDATE: The sheer amount of logic and edge cases this presents means it isn't really feasible for me to do right now. Luckily, baking keyframes pretty much solves this anyway. debug_mode only safety checks - to help save time checking stuff in release mode, but help you identify crashes otherwise. This is more important for Native mode as it may crash without a useful message if an invalid index is passed anywhere. Possibly an implementation of dual quaternion skinning on a per-armature-instance basis, which would potentially improve performance and increase bone-count cap by about 33% as well as reduce skin-collapsing artifacts, but at the cost of no scaling or axis/euler rotations. This would generally be better suited to organic-looking models (like humanoids and dogs) Try to get armatures working in HTML5. Get YYG to fix that shader bug... Update the GML code to use "structs" when they are added to GML to tidy up the code. (Depending on how the future IDE plugins work) A visual material editor to make materials more accessible, an in-IDE model previewer, do that thing Unity does and automatically convert ".blend" files if added to the project. Add the option to add material index to texcoord info via the exporter Done for v0.2.1 Allow the exporter to split meshes up by material Done for v0.2.1 Add a way to make the children of a bone use the same transform as the parent - reduces update and animation time and effectively produces a way to make skeleton LODs at runtime Done for v0.2.1! Turns out the performance boost is noticeable in both GML and Native. Add more default materials! Blinn-phong, cubemap reflections, etc. They are already made, but just need tidying for the public system. Integrate my shader-driven 3D particle system, port the optional z-sorting to native Add some more screenshots to this post Export light layouts for points and suns Done for the scene exporter Export camera information Done for the scene exporter Maybe add spot lights as part of the system? Include MMK_Skybox as part of the Kit Add export support for Blender's Curves as well as a system to get a position along the curve - integrating into scene exporter - Curves could be used to move cameras - how handy! Export completed for scene exporter Optimise and integrate the collision system and mesh exporter Done for v0.4 Port collisions to native code and see if we get a performance boost (Spoiler: we should!) Create the object data exporter Done Create a room generator and other convenience systems that use the JSON scene exporter Done! Make some kind of wrapper for Bullet Physics, perhaps. This may be a long-term sort of thing (beyond v1.0) that may never even happen. I'd include a way to automatically turn an armature instance into a ragdoll. I guess turn this into a full-3D engine, not just an animation driver Make a demo platformer project once everything else is done to showcase the system Some kind of a basic implementation of inverse kinematics for armatures (probably allows specification of target bone, chain length, armature-space target position, twistangle, twistroot/cumulitive?) Instance to instance 3D collisions Potentially more collision shapes (currently there is only ellipse and ray) Current Limitations Spoiler: Limitations Due to shader limitations, the maximum number of bones for a cross-platform model is around 64 (66 was the max I got working in an ES shader). Shaders with many other uniform variables will have a lower cap. You may be allowed more bones in HLSL11 shaders, depending on the shader model GameMaker decides to use, but this may result in compatibility issues with older graphics cards. Based on the shader limits (and the size of a byte), there is also a hard limit of 256 bones per armature. This many bones would likely be bad for performance anyway. If you need more bones, you could likely break an armature and assosiated meshes up in Blender. Disabling bone transform inheritance in Blender is not currently supported by the system and can produce odd results if not accounted for. HTML5 is kinda broken. Models load and meshes can be drawn, but armatures do not animate or render properly. One reason is this GameMaker bug with submitting uniform arrays: https://bugs.yoyogames.com/view.php?id=28850 but some matrices are filled with NaN too, which is a problem either with GM or somewhere in my code. You MUST check if shaders are supported by the current device if using armatures, as they are shader driven. I could add CPU-side skinning, but it would likely be too slow to be worthwhile, especially for devices that don't have a GPU anyway. For models imported without the "hlsl" import option, UVs, Tangent data and Blendweight/indices are all stored as Texcoords - which means you have to be careful with your materials! When imported with the "hlsl" option, data is stored with the valid semantics which makes this a non-issue, but the models are then only compatible with HLSL shaders until YYG add the other attribute types to GLSL ES Native Extension Spoiler The native extension passes armature animation and updating - the most intensive part of the system - to a C++ extension to help boost performance. The code is an optimised port of the GML code and the results should always be the same (if not, it's a bug). This has the advantage of animating models more quickly, but does have a small cost - an increase in memory usage occurs as animation and armature instance data is stored in both the extension and in GML. Model loading and armature instantiation times are slightly increased too as data is copied over to the extension at these times. Personally, I believe the small memory and initialization time cost is worth it for the overall speed gain. In the demo project from the video guide, I gained an average rfps increase of 124% in VM and a 23% increase in YYC by using the native version. In one practical project, I gained an FPS increase of around 20% in VM and a gain of 10% in YYC whe using Native vs GML. These improvements are likely to have more of an important impact if you have complex armatures or many armature instances updating simultaniously. If, however, you do wish to disable the native extension, simply call "MMK_disable_nativemode()". This should be called before any model loading, otherwise it will likely leave "dead" inaccessible memory in the extension. Note that native mode cannot be re-enabled during the same run due to the nature of how the data is copied. Given the lack of reason to disable native mode, it's likely the option to disable it will be removed. If this happens, I can remove the additional memory cost by only storing the data in the extension, instead of having duplicate data. Current Native TargetsWindows .DLL (Which likely also works with UWP and Xbox One, but I cannot test these platforms. If it doesn't work, it should automatically fall back to GML) Hopefully Upcoming Native Targets: Mac, Linux, Android, iOS Tips to Improve Performance Spoiler Armature animation is potentially slow. This is actually true for pretty much all games and engines. What's important is how you optimise when and how animation are done. Here a some tips to try to improve performance in your game: Pool armature instances where possible instead of creating a new one for every object. Reduces initialization time and memory allocations. If drawing many armatures in a dense area, consider using only a few armature instances and just reposition and reskin them per mesh to reduce animation calculations. This is good for crowds, for example. Only animate armatures that are within the view frustum Only animate armatures close enough to the camera to have a real, visible effect. You can also opt to only animate an armature once every few frames, depending on how close it is to the camera. This means you can still animate far away stuff at a lower cost. Use the native extension! There are no limitations to using it compared to GML mode and it gives a great speed boost. Use YYC! Whether you use the native extension or not, some of the code must be run within the GML side. YYC speeds up the rest of this, keeping FPS much higher. If using frame skipping techniques, only apply animations during visible frames. This may be undesirable if you use current bone transforms for certain events (e.g., calculating the position of a gun barrel) When animating, use fewer keyframes and only assign types you need within Blender! While baking animations and setting all keyframe types gives a more consistent result, it makes the system spend more time calculating frames. Fewer keyframes and keytypes means faster calculation Use armature LODs! For example, if not animating hands right now, use an armature without finger bones and a mesh with a static pose. Even idle bones add to the cost of updating an armature. You can achieve a similar effect and performance gain using the new "MMK_armature_bone_inherit_parent_transform" function Use "Pose Caching" where possible - by making use of "MMK_armature_set/get_matrix_output_array(armature, matrix)", you can cache and reset armature transforms with a single operation. This saves potentially thousands of operations while still having the animations looking perfect. It does mean that dynamic bone transforms are not accurate until an animation or transform is properly set without being overridden by the set_matrix_output function. In the simple demo scene, pose caching increased my average FPS real from abut 1300 to 2060 in VM. That's pretty significant! Increase the sleep margin! At the default of 1, I got all my results above. By raising it, my results increased by about 1000fps. *Note that this should be an option as higher sleep margins usually mean more power consumption when running your game, which isn't great for mobile. Bugs? Questions? Suggestions? Reply to this post and I'll see what I can do! Thanks for giving me a chance.