{"id":15424789,"url":"https://github.com/antoniond/dsma-library","last_synced_at":"2025-04-19T15:34:00.015Z","repository":{"id":78603479,"uuid":"549126555","full_name":"AntonioND/dsma-library","owner":"AntonioND","description":"DS Model Animation Library","archived":false,"fork":false,"pushed_at":"2024-07-01T22:52:49.000Z","size":664,"stargazers_count":12,"open_issues_count":1,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2025-04-12T21:44:06.081Z","etag":null,"topics":["3d-models","demoscene","homebrew","md5-models","nintendo-ds"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/AntonioND.png","metadata":{"files":{"readme":"readme.rst","changelog":null,"contributing":null,"funding":null,"license":"licenses/cc0-1.0.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-10-10T18:04:09.000Z","updated_at":"2025-03-27T17:30:37.000Z","dependencies_parsed_at":"2024-06-02T12:27:12.291Z","dependency_job_id":"2b3a97f5-f89e-4d64-9313-0954a6f9b9af","html_url":"https://github.com/AntonioND/dsma-library","commit_stats":{"total_commits":23,"total_committers":1,"mean_commits":23.0,"dds":0.0,"last_synced_commit":"5988ef1eb6d10141728cea129306764e27849684"},"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AntonioND%2Fdsma-library","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AntonioND%2Fdsma-library/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AntonioND%2Fdsma-library/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/AntonioND%2Fdsma-library/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/AntonioND","download_url":"https://codeload.github.com/AntonioND/dsma-library/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":249727630,"owners_count":21316709,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["3d-models","demoscene","homebrew","md5-models","nintendo-ds"],"created_at":"2024-10-01T17:48:44.938Z","updated_at":"2025-04-19T15:33:59.985Z","avatar_url":"https://github.com/AntonioND.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"DSMA Library\n============\n\nIntroduction\n------------\n\n**DSMA** (DS Model Animation) is a library that allows you to convert animated\nmodels saved in MD5 format into a format that can be displayed in the Nintendo DS\nin a very efficient way. This library depends on **libnds**. You can use the\nlibrary with `BlocksDS \u003chttps://blocksds.github.io/docs/\u003e`_ or `devkitPro\n\u003chttps://devkitpro.org\u003e`_. The examples in this repository use BlocksDS.\n\nMD5 supports skeletal animation, which lets you reuse the same model with\nmultiple animations (a **md5mesh** file can be used with multiple **md5anim**\nfiles). This library works in a similar way.\n\nThe converter used for this library is called **md5_to_dsma**, and it generates\nthe following files:\n\n- **DSM** (DS Model): It contains a display list with the geometry of the model.\n- **DSA** (DS Animation): It contains the position and orientation of all bones\n  in a specific animation sequence. You can have multiple DSA files for a single\n  DSM model if you have multiple animations for it.\n\nThe library supports interpolation between frames so that DSA files can have a\nsmaller size by reducing the number of stored frames in it. It also supports\nblending two animations to make seamless transitions between them.\n\nYou are expected to load the files in some way (either including them as binary\ndata in your game, or loading them from the filesystem) and pass them to the\nfunctions exposed by the library header.\n\nThere are multiple examples of how to use the library in this repository. They\nall use libnds, and most of the 3D setup code is generic libnds 3D setup code.\nYou can build them with `BlocksDS \u003chttps://blocksds.github.io/docs/\u003e`_ and you\ncan test them with an emulator such as **DeSmuME** or **melonDS** or in real\nhardware with a flashcard.\n\n- **basic_model**: Simply load an animated model embedded in the binary.\n- **blended_animations**: Blend two animations in the same model.\n- **filesystem_loading**: Load models from the filesystem (with **nitroFS**).\n  Note that this example won't work in **melonDS** if it's built with devkitPro\n  due to a bug in their implementation of NitroFS.\n- **multiple_animations**: Display one model with multiple animations.\n- **performance**: Show how much CPU time it takes to draw an animated model.\n- **stress_test**: Show multiple animated models with different animations.\n\nYou can download them pre-compiled from the **Releases** page on GitHub:\n\nhttps://github.com/AntonioND/dsma-library/releases\n\nThis is an example of multiple models being displayed on the screen:\n\n.. image:: examples/stress_test/screenshot.png\n\nThe library is under the MIT license, and the examples are licensed under the\nCC0 license.\n\nTo get the latest version of this library, go to the repository:\nhttps://github.com/AntonioND/dsma-library\n\nGenerating and converting MD5 models\n------------------------------------\n\nYou can't use any MD5 model with this library. There is a limit in the number of\nbones in the skeleton used in your model. Each bone transformation is stored as\none matrix in the DS matrix stack, which means that you have, at best, space for\n29 bones. However, in most cases, the actual space will be smaller (because the\nprogram also uses that space).\n\nAlso, it isn't possible to have multiple weights for the same vertex. The MD5\nformat mandates that all vertices are assigned at least one weight, but\n``md5_to_dsma`` will make sure that all vertices have assigned exactly one weight\nwith a value of 1.0.\n\nYou can use any 3D design tool to create your models, as long as you can export\nthem as MD5 later. Personally, I use blender to generate my models, and I use\nthis addon https://github.com/KozGit/Blender-2.8-MD5-import-export-addon to\nexport them as MD5 files. In short: Design your model as usual, making sure that\nall your weights are 1.0. Then, clean up the weights of the model (to remove any\nweight of 0.0, the exporter will fail if they aren't removed). Make sure that\nall the bones have been moved to layer 5 (so that the exporter finds them) and\nexport the model and animations.\n\n``md5_to_dsma`` can be used to convert a ``md5mesh`` file, a list of ``md5anim``\nfiles, or both at the same time.\n\nConvert all files in one run:\n\n.. code::\n\n    md5_to_dsma.py --model Robot.md5mesh \\\n                   --name robot \\\n                   --output out_folder \\\n                   --texture 128 128 \\\n                   --anim Wave.md5anim Walk.md5anim Bow.md5anim\n\nConvert the mesh only:\n\n.. code::\n\n    md5_to_dsma.py --model Robot.md5mesh \\\n                   --name robot \\\n                   --output out_folder \\\n                   --texture 128 128\n\nConvert the animations only:\n\n.. code::\n\n    md5_to_dsma.py --anim Wave.md5anim Walk.md5anim Bow.md5anim \\\n                   --name robot \\\n                   --output out_folder\n\nConverting textures\n-------------------\n\nIn order to convert textures you can use:\n\n- **grit**: Distributed by BlocksDS and devkitPro. It supports all texture\n  formats except for Tex4x4.\n- `ptexconv \u003chttps://github.com/Garhoogin/ptexconv\u003e`_: It supports all texture\n  formats, even Tex4x4.\n\n``md5_to_dsma``\n---------------\n\nThe options supported are:\n\n- ``--output``: Output folder. It will be created if it doesn't exist.\n\n- ``--model``: ``md5mesh`` file to convert. All MD5 models come with a base\n  pose, which is exported as a DSA file. The model itself is saved as a DSM\n  file.\n\n- ``--texture``: Texture size of the model. This is required. The DS doesn't\n  use floating point values for texture coordinates, so you can only use\n  textures of the size specified when converting the model. For example, a 32x64\n  texture, do ``--texture 32 64``.\n\n- ``--anims``: List of ``md5anim`` files to convert. Each animation is saved as\n  a DSA file.\n\n- ``--name``: Base name used for the output files.\n\n- ``--blender-fix``: Blender uses Z as \"up\" axis, but the DS uses Y as \"up\".\n  This makes it very awkward to export models from Blender to DS. This option\n  rotates them by -90 degrees on the X axis so that they use the natural system\n  of coordinates of the DS instead of the one of Blender.\n\n- ``--bin``: When this is used, ``.bin`` is added to the end of all the names of\n  the files generated by the tool. This is useful if you want to copy the files\n  to a ``data`` folder of a libnds template and you don't want to modify the\n  ``Makefile`` to accept new file extensions. This option isn't required if you\n  are using **libfilesystem**, **libfat** or similar and you're loading files\n  from a filesystem.\n\n- ``--export-base-pose``: ``md5mesh`` files contain a base pose. This option\n  will export this base pose as a DSA file with one frame.\n\n- ``--skip-frames``: Number of animation frames to skip after exporting each\n  frame. For example, to skip half of the frames, do ``--skip-frames 1``, and to\n  only export 25% of the frames, do ``--skip-frames 3``.\n\n- ``--draw-normal-polygons``: This is only useful for debugging. It will export\n  additional polygons that represent the normals of the model in its base pose\n  (they won't move when you animate the model).\n\nDisplaying models on the NDS\n----------------------------\n\nThe library only has three functions:\n\n- ``DSMA_GetNumFrames()``\n\n  Returns the number of frames of the animation in a DSA file.\n\n- ``DSMA_DrawModel()``\n\n  Draws the model in a DSM file with the animation in a DSA file.\n\n  The value of the frame to be drawn is a fixed point value (20.12, or ``f32``).\n  If the frame is an integer value there is no interpolation between frames. If\n  the frame value is between frames the function will interpolate between them.\n\n- ``DSMA_DrawModelBlendAnimation()``\n\n  Draws the model in the DSM file animated with the data in the specified DSA\n  files, at the requested frame, with the requested blending factor between the\n  two animations.\n\n  This allows you to merge two animations while you're switching from one to the\n  other one, for example.\n\nFuture work\n-----------\n\n- Smooth shading (only flat shading is supported at the moment).\n- Optimize normal commands (if multiple vertices belong to the same joint and\n  have the same normal).\n- Container files to hold multiple DSM and DSA files.\n\nThanks to\n---------\n\n- **devkitPro**: For helping develop the first version of the library.\n  https://devkitpro.org/\n- **Blender**: https://www.blender.org/\n- **Blender** addon used to generate models:\n  https://github.com/KozGit/Blender-2.8-MD5-import-export-addon\n- MD5 format information: http://tfc.duke.free.fr/coding/md5-specs-en.html\n- Quaternion to matrix conversion: http://www.songho.ca/opengl/gl_quaternion.html\n- **DeSmuME**: http://desmume.org/\n- **melonDS**: https://melonds.kuribo64.net/\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantoniond%2Fdsma-library","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fantoniond%2Fdsma-library","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fantoniond%2Fdsma-library/lists"}