Package: manim-meshes
Manim for Meshes⚠️ not fully optimal - but fine for smaller meshesManim and the OpenGL renderer are not really friends right now, therefore most of the code runs terribly slow for larger meshes. In Addition to the small educational meshes we present a faster mesh that uses a custom shader but this requires manipulating the manim library.Stay tuned or feel free to assist. Either here or directly in the manim OpenGL part. Not necessarily everything is a Bézier curve...Manim-Trimeshes implements manim functionalities for different types of meshes using either basic node-face data structures or by importing meshes from the pythontrimeshlibrary.It is mainly developed as a Project for Interactive Graphics Systems Group (GRIS) at TU Darmstadt University, but is made publicly available for everyone interested in rendering and animating meshes.InstallationManim-meshes has been published topypiand therefore can be easily installed using:pip install manim-meshesUsagefrom manim_meshes import *While executing a commandline manim script, make sure to set the--renderer=openglflag, the Cairo renderer will ins most cases not work.The basicManimMeshandManim2DMeshfrommanim_models/basic_meshcan currently only be used for smaller meshes (<1k Nodes), because it is dependent on the manim internal shaders which are not really implemented optimally. This type of mesh can be easily used for 2D and smaller 3D explanatory videos, not for high resolution rendering. Both these classes should give manim-functionalities like shift, rotate and scale. But due to the sheer amount of MObject functions we can not implement all of them, so make sure the renderer has overwritten the method you are trying to use if something does not look right.TheTriangleManim2DMeshfromtriangle_meshimplements further functions that are only reasonable for two-dimensional triangle meshes. (e.g. Delaunay) This was designed for educational purposes. There is also a packagedelaunaycontaining multiple useful functions regarding delaunay triangulations, e.g. Voronoi diagrams, checking the delaunay criterion or a divide & conquer algorithm.The more advancedFastManimMeshfromopengl_meshuses a custom shader which needs to be inserted into the base manim implementation at this time! But therefore it can render enormous meshes fast. Sadly rendering is kind of everything this renderer is capable of at the moment.All these Mesh-Renders reference a mesh based on theMesh-Class, indata_models, which should implement a multitude of basic Mesh-functions.ExampleWith active poetry venv Run one of the minimal test examples:manim --renderer=opengl tests/test_scene.py ConeScene.Multiple other examples can be found in thetests/test_scene.pyfile.The general procedure is like in manim, create a class with a construct method. Then create and add the instance of the renderable mesh you like to use. This mesh will receive the real node-face mesh and manipulate it.
You can shift (translate) and scale the whole mesh or single vertices. Additionally most of the manim functions are available as coloring single objects. Somehow Rotate does not work, because it only updates the copy of the rotation and therefore our own mesh class does not get updated.ParametersAs parameters got a little overwhelming, there are a few default parameters for the meshes inparams.py. You just need to pass kwargs that you want to change while creating the mesh.DevelopmentIn PyCharm set./src/-folder as project sources root and./tests/-folder as tests sources root if necessary.Install poetry according to your likings.Activate the poetry venv:cd ./manim_meshes/, thenpoetry shellInstall:poetry installIf you get errors, it is possible that you have to pip installpycairoand ormanimpangomanually (globally?), depending on your setup. Make sure to runpoetry installuntil there are no more errors!After updating packages make sure to update poetry and your git .lock file:poetry updateIf you implemented some features, update version using the matching poetry command:poetry version prerelease|patch|minor|majorSee the PoetryDocumentation.
If the CI works properly, Publishing to pypi on master branch is automatically, it can be done manually with the correct privileges:poetry publish --build. Don't hesitate to contact any of the developers or open issues.DebuggingLike with basic manim, create an executable Python file with something around:fromtests.test_sceneimportSnapToGridSceneif__name__=="__main__":scene=SnapToGridScene()scene.render()Then debug the file and place breakpoints as expected. May not work with the "renderer=opengl" flag that is necessary for some scripts. Please update this example if you found out how to do it.