https://github.com/bmmtstb/manim-meshes

2D and 3D basic mesh implementation for manim

https://github.com/bmmtstb/manim-meshes

Science Score: 13.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.9%) to scientific vocabulary

Keywords

manim-animations manim-engine manim-python mesh python trimesh
Last synced: 6 months ago · JSON representation

Repository

2D and 3D basic mesh implementation for manim

Basic Info
  • Host: GitHub
  • Owner: bmmtstb
  • License: mit
  • Language: Python
  • Default Branch: master
  • Homepage:
  • Size: 5.4 MB
Statistics
  • Stars: 44
  • Watchers: 1
  • Forks: 7
  • Open Issues: 3
  • Releases: 4
Topics
manim-animations manim-engine manim-python mesh python trimesh
Created over 3 years ago · Last pushed over 2 years ago
Metadata Files
Readme License

README.md

Python Test and Lint CodeQL

Manim for Meshes

⚠️ not fully optimal - but fine for smaller meshes

Manim 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 python trimesh library.

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.

Installation

Manim-meshes has been published to pypi and therefore can be easily installed using:

pip install manim-meshes

Usage

from manim_meshes import *

While executing a commandline manim script, make sure to set the --renderer=opengl flag, the Cairo renderer will ins most cases not work.

The basic ManimMesh and Manim2DMesh from manim_models/basic_mesh can 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.

The TriangleManim2DMesh from triangle_mesh implements further functions that are only reasonable for two-dimensional triangle meshes. (e.g. Delaunay) This was designed for educational purposes. There is also a package delaunay containing multiple useful functions regarding delaunay triangulations, e.g. Voronoi diagrams, checking the delaunay criterion or a divide & conquer algorithm.

The more advanced FastManimMesh from opengl_mesh uses 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 the Mesh-Class, in data_models, which should implement a multitude of basic Mesh-functions.

Example

Static image of a cone, to show the rendering capabilities

With 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 the tests/test_scene.py file.

see the PyramidScene for basic manim mesh uses

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.

Parameters

As parameters got a little overwhelming, there are a few default parameters for the meshes in params.py. You just need to pass kwargs that you want to change while creating the mesh.

Development

In 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/, then poetry shell

Install: poetry install If you get errors, it is possible that you have to pip install pycairo and or manimpango manually (globally?), depending on your setup. Make sure to run poetry install until there are no more errors!

After updating packages make sure to update poetry and your git .lock file: poetry update

If you implemented some features, update version using the matching poetry command: poetry version prerelease|patch|minor|major See the Poetry Documentation. 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.

Debugging

Like with basic manim, create an executable Python file with something around:

python from tests.test_scene import SnapToGridScene if __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.

Owner

  • Name: Brizar
  • Login: bmmtstb
  • Kind: user

GitHub Events

Total
  • Watch event: 6
  • Fork event: 3
Last Year
  • Watch event: 6
  • Fork event: 3

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 2
  • Total pull requests: 61
  • Average time to close issues: N/A
  • Average time to close pull requests: about 1 month
  • Total issue authors: 1
  • Total pull request authors: 2
  • Average comments per issue: 0.0
  • Average comments per pull request: 0.69
  • Merged pull requests: 19
  • Bot issues: 0
  • Bot pull requests: 60
Past Year
  • Issues: 0
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 0
  • Pull request authors: 0
  • Average comments per issue: 0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • bmmtstb (2)
Pull Request Authors
  • dependabot[bot] (58)
  • bmmtstb (1)
Top Labels
Issue Labels
enhancement (1) bug (1) help wanted (1)
Pull Request Labels
dependencies (58)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 76 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 0
  • Total versions: 14
  • Total maintainers: 1
pypi.org: manim-meshes

rendering 2D and 3D Meshes with manim for displaying and educational Purposes.

  • Versions: 14
  • Dependent Packages: 0
  • Dependent Repositories: 0
  • Downloads: 76 Last month
Rankings
Dependent packages count: 6.6%
Stargazers count: 14.9%
Average: 20.9%
Downloads: 21.7%
Forks count: 30.5%
Dependent repos count: 30.6%
Maintainers (1)
Last synced: 6 months ago

Dependencies

.github/workflows/codeql-analysis.yml actions
  • actions/checkout v3 composite
  • github/codeql-action/analyze v2 composite
  • github/codeql-action/autobuild v2 composite
  • github/codeql-action/init v2 composite
.github/workflows/python_ci.yaml~ actions
  • actions/checkout v3 composite
  • actions/setup-python v3 composite
.github/workflows/python_ci_test.yaml actions
  • actions/cache v3 composite
  • actions/checkout v3 composite
  • actions/setup-python v4 composite
  • snok/install-poetry v1 composite
pyproject.toml pypi
  • meshio ^5.3.4 develop
  • pylint * develop
  • pytest ^7.2.0 develop
  • typing * develop
  • ManimPango ^0.4.1
  • decorator ^5.0.9
  • manim ^0.16.0
  • manimgl ^1.6.1
  • moderngl *
  • numpy *
  • python 3.8.*
  • trimesh ^3.12.5