Open mattdeitke opened 4 years ago
No, that's unfortunately not possible, and I guess that manim is not the right platform for that. Probably you should have a look on Blender to do that. My idea for a workaround is to somehow convert your .obj data in a 3d- numpy array grid, and then with this code you can display all the Points where the grid has a "one":
class ImageScene(ThreeDScene):
def construct(self):
self.set_camera_orientation(phi=75 * DEGREES, theta=-60 * DEGREES) # 2.5D
self.begin_ambient_camera_rotation()
Disp_array= VMobject()
for x in range(-3, 3):
for y in range(-3, 3):
for z in range(-3, 3):
dot = Dot(point=(x, y, z))
Disp_array.add(dot)
[Disp_array.submobjects[i].set_color(RED) for i in range(0,100)]
self.add(Disp_array)
self.wait(2)
I tried to customise classes for loading and rendering.obj
3D model. Please find it here. open3d package is needed because I use it as the .obj
parser.
Currently, the Mesh
class can't load very complex meshes (say more than 1000 faces) due to the efficiency issue. In this case, please use the Point_Cloud
class which resamples them as a point cloud, lowering the computational stress to a handleable level.
Below is a sample: the complex human mesh was rendered with Point_Cloud
and the simple polyhedron was rendered with Mesh
. Hoping that it can serve your need:
from manim import *
from concept import obj_model
class Test(ThreeDScene):
def construct(self):
self.set_camera_orientation(phi=60 * DEGREES)
pcd = obj_model.Point_Cloud("gallery/material/body.obj")
pcd.lightup()
pcd.rotate(90*DEGREES, RIGHT)
mesh = obj_model.Mesh("gallery/material/cube.obj")
mesh.lightup()
mesh.rotate(90*DEGREES, RIGHT).next_to(pcd, RIGHT)
self.add(pcd)
self.add(mesh)
self.begin_ambient_camera_rotation(rate=4)
self.wait()
I would also be interested by this feature, ideally I’d love to be able to play animation (e.g. in blender I record an animation to raise the hand, or walk, and this should be actionable in manim).
Is there any way to add custom 3D .obj files to a scene? I know that 3D plots and a few primitive shapes can be added, but have not seen any way to add custom 3D objects.
Thanks!