Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rewriting the rendering System of Manim to a modern standard 💥 💯 #3112

Draft
wants to merge 123 commits into
base: main
Choose a base branch
from

Conversation

MrDiver
Copy link
Collaborator

@MrDiver MrDiver commented Jan 3, 2023

Overview: What does this pull request change?

Caution

The info on this PR description is OUTDATED. See #3817 for progress tracking and goals of this PR.

Old PR Description

This pull requests ports all the new changes from 3b1b/manim and adds type hints to OpenGLMobject and OpenGLVmobject

Current annotations and state is pushed in https://github.com/MrDiver/manimlib
Every method commented with #DONE is already in this PR

Ported Features

  • Camera
  • CameraFrame
  • OpenGLMobject
  • OpenGLVMobject
  • EventDispatcher
  • Shader
  • ShaderWrapper
  • Scene
  • ...

TODO:

  • Removing Cairo renderer
  • Adapting structure to new scene

changelog

OpenGLMobject

⚠️ Might be inconsistent with current state of the PR ⚠️

Additions:
init_constructor, __add__, __mul__, are_points_touching, is_touching, apply_over_attr_arrays, get_ancestors, insert_submobject, set_submobject, set_rgba_array, set_color_by_rgba_func, set_color_by_rgb_func, set_rgba_array_by_color, arrange_to_fit_dim, replicate
Renamed:
set_rgba_array -> set_rgba_array_by_color (added new set_rgba_array)
set_rgba_array_direct -> set_rgba_array

Removed/Depcrecated:
set_rgba_array_direct

Changes:

  • self.uniform.fixed_orientation_center is now a np.ndarray
  • __init__:
    • Now holds all initial self.x = x assignments and the rest of the constructor which is useful to see is now in init_constructor
  • set_points:
    • Uses asarray instead of array to not unnecessarily copy arrays when not needed.
  • add_updater:
    • now uses self.update(dt=0)
  • set_color:
    • now uses set_rgba_array_by_color instead of setting color directly
  • set_opacity:
    • now uses set_rgba_array_by_color
  • interpolate:
    • now treats all uniforms equally
  • fix_orientation:
    • creates a np.ndarray to set fixed_orientation_center instead of tuple

Temporary changes:

  • check_data_alignment:
    • Does not directly work on self.data instead returns the new result directly to be used in get_resized_shader_data_array

OpenGLVmobject

Additions:

  • @property:stroke_opacity, _stroke_opacity, @property:stroke_width, _stroke_width

Removed/Deprecated

Changes:

Temporary changes:


Shader

Additions:

Removed/Deprecated

Changes:

  • set_uniform:
    • now converts np.ndarray to tuple for easier outside usage to only need to convert on the last step when creating uniforms

Temporary changes:


…` again (#3107)

* ported functionality of Mobject from 3b1b to OpenGLMobject

* ported functionality of VMobject from 3b1b to OpenVGLMobject

* first working render

* first step to dump old scene structure

* copied scene without adapting
Copy link

@github-advanced-security github-advanced-security bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CodeQL found more than 10 potential problems in the proposed changes. Check the Files changed tab for more details.

@behackl behackl marked this pull request as draft January 3, 2023 12:11
@behackl
Copy link
Member

behackl commented Jan 3, 2023

I'll make this a draft for now (and I don't expect the tests to pass any time soon) -- but we'll try some more drastic refactoring strategies here.

behackl and others added 26 commits January 3, 2023 13:21
Co-authored-by: Tristan Schulz <[email protected]>
JasonGrace2282 and others added 9 commits October 24, 2024 22:01
* Fix tests and verify Animation run time inside new run_time property setter

* test_boolean_ops

* Add run_time validation from main branch

* Fix 2 tests in tests/module/mobject/mobject/test_mobject.py

* Fix 2 tests in tests/module/mobject/text/test_text_mobject.py

* Manager in test_file_writer.py
MrDiver and others added 20 commits November 26, 2024 06:38
…crashes in subclasses (#4056)

* Change order of statements in `OpenGLVMobject.__init__()`
…()` (#4058)

The original implementation of `STD140BufferFormat._write_padded()` used `np.pad` which is slow.
This new implementation avoids that by creating a new array of zeroes instead. In this way, this method now takes 60x less time, and the total rendering time is almost halved.
Covers the Manager, ThreeDScene, Camera, and Animations

Co-authored-by: Francisco Manríquez Novoa <[email protected]>

---------

Co-authored-by: Francisco Manríquez Novoa <[email protected]>
…4059)

Co-authored-by: Aarush Deshpande <[email protected]>
Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
breaking changes This PR introduces breaking changes experimental highlight For contributions that should be highlighted explicitly in the next changelog refactor Refactor or redesign of existing code
Projects
Status: 🆕 New
Development

Successfully merging this pull request may close these issues.

6 participants