Repository navigation
Manim v0.22.0 #5057
behackl
announced in
Announcements
Manim v0.22.0
#5057
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
See our rendered changelog.
Highlights 🌟
Unified output selection and configurable video encoding
Choosing what Manim produces has been reworked around a single
formatsetting.
--format(orformatin the[CLI]section of a config file)selects exactly one primary artifact:
auto(the default; MP4, or MOV fortransparent output),
mp4,mov,webm,gif,png(last frame only),png-sequence(every frame), ornone(evaluate the scene without writingmedia). It replaces the overlapping
--write_to_movie,-g/--save_pngs,-i/--save_as_gif, and--force_windowoptions. Viewing the result is nowseparate from choosing what to write:
-p/--previewopens the finished filewith either renderer, while
-l/--live-previewshows a live window (OpenGL).As a consequence, the OpenGL renderer now writes files by default, just like
Cairo. The
--custom_folderspreset has been removed in favor of settingeach output location separately. (#4966, #4969)
Video encoding is now configurable, too: the new
[video_encoder]configsection and the
--video-codec,--pixel-format, and repeatable--encoder-option KEY=VALUEoptions control how partial movie files areencoded, for example
manim render --video-codec libx264 --encoder-option crf=18 --encoder-option preset=slow scene.py.The new
manim cache clearcommand replaces the--flush_cacheflag. (#4976)Scenes rendered with default settings need no changes, but scripts and config
files relying on the removed options have to be updated. See the migration
notes in the Breaking Changes section below.
Comprehensive documentation for the updated configuration system
can be found in the
configuration guide and the
output settings tutorial.
A
Managerfor coordinating the render flowThis release takes a first step towards a full overhaul of Manim's
render lifecycle by introducing a
Managerobject that coordinatesthe processing of a
Scene. Regular scenes (i.e., those withoutcustom cameras, renderers, or file writers) do
not need any changes.
Until now, the responsibilities of the render lifecycle were spread
across
Scene, the renderer, the camera, and the file writer.As the name suggests, the
Manageris now the central manager of this process.This release lays the foundation for the new architecture. The render
loop has not been fully restructured yet.
Upcoming releases will build on this to move rendering execution
and file writing into the
Manager.This will allow us to remove the remaining cross-dependencies between
scenes, renderers, and file writing.
The rendering deep dive has been updated to
describe the new flow. (#4916)
Improved rendering of
Textetc. with small font sizeThis release also features a new version of our plain text rendering
engine (
Pango) wrapperManimPangothat fixes a long-standing issue with the kerning(spacing between letters) for text with very small font sizes. Now
mobjects like
Text("hello world, this is a test", font_size=1)look crispand are typeset as intended. (#5041)
What's Changed
Breaking Changes 🚨
Introduce a
Managerto coordinate the render flow by @behackl in Introduce aManagerfor render-flow coordination #4916Scenes, including overrides of
setup,construct, andtear_down, need nochanges.
Scene.render,Scene.play,Scene.next_section,Scene.add_subcaption, andScene.add_soundnow delegate to the scene'sManager(scene.manager), which owns the render lifecycle formerlyimplemented in
Scene.render. Code that reimplemented or patched theseinternals should call the public
Scenemethods instead of driving therenderer or file writer directly. The "Rendered … Played N animations" log
record now originates from the
managermodule instead ofscene.Rework output configuration options and how they are consumed by @behackl in Rework output configuration options and their consumption #4966
Output is now selected with the single
formatoption; the old switches havebeen removed:
--write_to_movie/write_to_movie = True: use the defaultformat = autoor an explicitmp4,mov,webm, orgif;write_to_movie = Falsebecomesformat = none.-g/--save_pngs:--format png-sequence(frames are written tomedia/images/<module>/<Scene>/).-i/--save_as_gif:--format gif.save_last_framein config files:format = png. The-sflag andconfig.save_last_framestill work.--force_window:-l/--live-preview; add a concrete format to alsorecord the live render.
-f:--show_in_file_browser.config.movie_file_extension:config.format.Behavior changes:
--format pngsaves only the last frame; an explicit videoformat fails for scenes without
playorwaitcalls (autosaves a PNGinstead); with OpenGL,
-popens the finished file instead of a live windowand files are written by default; transparent output requires
auto,mov,or
webm. Output settings are captured when aSceneis constructed, socreate scenes inside the intended
tempconfigblock. Rendering no longeroverwrites
config.output_file; readscene.renderer.file_writer.final_file_pathinstead. The format helpersis_mp4_format,is_gif_format,is_png_format,is_webm_format,is_mov_format, andwrite_to_moviewere removed frommanim.utils.file_ops; inspectscene.session_specorscene.manager.output_specinstead. For custom renderers and file writers,see Refactor: move video segment encoding to dedicated module and detach
SceneFileWriterfrom renderer state #4976.Refactor media output path resolution and remove the
--custom_foldersCLI flag and config option by @behackl in Refactor: media output path resolution + removal of--custom_foldersCLI flag and config option #4969--custom_folders,config.custom_folders, and the[custom_folders]configsection have been removed; set the regular directory options under
[CLI]instead. The former preset corresponds to:
-o/--output_fileis now rejected when rendering more than one scene(with
-aor several scene names); drop it or render scenes separately. Theresolved format determines the file suffix, so
-o movie.mov --format mp4produces
movie.mov.mp4. Section videos now include the section name (e.g.MyScene_0000_create-square.mp4); read filenames from thevideofield ofthe section JSON instead of constructing them.
Move video segment encoding to a dedicated module and detach
SceneFileWriterfrom renderer state by @behackl in Refactor: move video segment encoding to dedicated module and detachSceneFileWriterfrom renderer state #4976Replace
--flush_cacheandflush_cache = Truewithmanim cache clear scene.py SceneName. The[ffmpeg]config section is now[media](loglevelstays the same), andconfig.ffmpeg_loglevelis nowconfig.media_loglevel. Cache keys now include the encoder settings, soexisting cached segments are re-rendered once.
SceneFileWriter.clean_cache()and
flush_cache_directory()were replaced byprune_segment_cache()andclear_segment_cache()inmanim.utils.caching.Custom renderers and file writers:
init_scenenow has the signatureinit_scene(scene, session_spec, file_writer_settings), and the writer isconstructed from these settings alone (it no longer receives the renderer or
reads the global
config). Renderers must declarecapabilities. Frames arepassed as owned
uint8RGBA arrays of shape(height, width, 4)withtop-left origin:
write_frame(pixels, repeat=n)andsave_image(pixels);begin_animation()andopen_partial_movie_stream()additionally requireanimation_index=.get_hash_from_play_call()requires thebackend,encoder_fingerprint, andrenderer_statekeyword arguments, andget_full_sound_file_path()requiresassets_dir.Enhancements 🚀
throw_error_if_no_pointsand raiseValueErrorinstead ofExceptionby @smmariquit in Enhancethrow_error_if_no_pointserror message #4927keyparameter tolist_updateandlist_difference_updateto support unhashable elements by @nikolajmunk in Add key function to handle unhashable element input inlist_updateandlist_difference_update#4975Bug Fixes 🐛
"opengl"never matched by @pjfo in fix: renderer comparisons against "opengl" string never matched #4929GraphandDiGraphto be initialized without vertices by @christopher-hampson in Fix: Allow Graph Mobject to be initialised with an empty list of vertices #4946VGroup.__str__by @nikolajmunk in Add proper singular/plural form of "submobject(s)" in VGroup __str__ #4950OpenGLMobject.is_off_screenby @GniLudio in Fix OpenGLMobject.is_off_screen right-bounds check #4953OpenGLMobject.stretch_to_fit_depthstretching along the wrong dimension by @GniLudio in Fix dim of OpenGLMobject.stretch_to_fit_depth #4955OpenGLMobject.get_boundary_pointby @GniLudio in Fix OpenGLMobject.get_boundary_point #4956ManimConfigby @emerardd in fix(config): restore renderer class bases on config update #4958LaggedStartMapunpacking submobjects when using the defaultarg_creatorby @SAY-5 in Fix LaggedStartMap unpacking submobjects with the default arg_creator #4965np.sumcalls on generators, fixing aTypeErrorwith the OpenGL renderer by @christopher-hampson in fix: np.sum deprecation for generators #4962MathTypstcapture groups by @behackl in Preserve layout of MathTypst capture groups #4960normalizeraising an error instead of returning the fallback vector for zero-norm vectors by @nikolajmunk in Fix: Makenormalizeproperly check for a fallback when vector norm is 0 #5001is_closedmisclassifying closed curves in negative coordinate space by @Osamaali313 in Fix is_closed misclassifying closed curves in negative coordinate space #5010angle_axis_from_quaternionreturning the inverse rotation for angles greater than π by @dylanpulver in fix(space_ops): flip the axis when angle_axis_from_quaternion folds the angle #4980LineJointType.AUTOandCapStyleType.AUTOinheriting the previous mobject's style in the Cairo renderer by @RizgarOzan in Fix AUTO cap style and joint type inheriting the previous mobject's style in Cairo renderer #5016BarChartignoringinclude_numbersiny_axis_configby @RizgarOzan in Fix BarChart ignoring include_numbers in y_axis_config #5015stroke="none"getting a white outline by @RizgarOzan in Fix SVG shapes with stroke="none" getting a white outline #5036colorargument ofTextandMarkupTextnot being applied to the mobject itself by @webzuweb in Fix Text/MarkupText color argument not applied to the mobject #5017redirectionsparameter of thedeprecated_paramsdecorator by @GniLudio in Fixredirectionsparameter ofdeprecated_paramsdecorator #5028ThreeDScene.set_camera_orientationwith the OpenGL renderer by @Smail in FixThreeDScene.set_camera_orientationwith the OpenGL renderer #5040Mobject.insertandOpenGLMobject.replace_submobjectpermitting duplicate submobjects by @nikolajmunk in Improve speed and robustness ofMobjectandOpenGLMobjectadd/remove operations #4957Performance ⚡
list_updateandlist_difference_updateby using a set for membership checks by @nikolajmunk in Perf: Use temporary set to to speed up list_update and list_difference_update #4939get_familyand fix families containing loops by @GniLudio in Remove recursive remove_list_redundancies in get_family #4947MobjectandOpenGLMobjectadd/remove operations by @nikolajmunk and @GniLudio in Improve speed and robustness ofMobjectandOpenGLMobjectadd/remove operations #4957Documentation 📚
ConvexHullexample in the rendered documentation by @behackl in Fix flaky ConvexHull example in rendered docs #4967TangentialArcby @henrikmidtiby in Small update to tangential arc docs #5046Testing 🧪
Type Hints 📝
ParamSpecin deprecation decorators to preserve signatures of decorated callables by @GniLudio in Use ParamSpec for deprecation decorators #4988vector_field.pyby @henrikmidtiby in Add type hints to vector_field.py #5030Dependencies 📦
Other Changes
v0.22.0by @behackl in Prepare new release:v0.22.0#5050New Contributors
throw_error_if_no_pointserror message #4927ThreeDScene.set_camera_orientationwith the OpenGL renderer #5040Full Changelog: Compare view
This discussion was created from the release Manim v0.22.0.
All reactions