Skip to content

Conversation

Aathish04
Copy link
Member

Overview: What does this pull request change?

Add an OBJMobject which allows users to make use of 3D models from .obj files.

Motivation and Explanation: Why and how do your changes improve the library?

It's tedious and laborious to make complex 3D models in Manim by hand.
One can now make a 3D model in 3rd party software better suited to the task (such as Blender) and import the model into Manim using OBJMobject.

One can use OBJMobject like so:

class Test(ThreeDScene):
    def construct(self):
        self.set_camera_orientation(
            phi=-45 * DEGREES,
            theta=-135 * DEGREES,
            gamma=-55 * DEGREES)
        model = OBJVMobject("/Users/aathishs/Projects/Python/ManimStuff/manim-projects/threedfilemob/airboat.obj").scale(0.5)
        self.play(Write(model))
        self.play(Rotate(model,axis=UP,angle=2*PI),run_time=5,rate_func=linear)
        self.wait(1)

The Output for the code above is:

Test.mp4

Links to added or changed documentation pages

Documentation is WIP

Further Information and Comments

The .obj file can be found at :

https://people.sc.fsu.edu/~jburkardt/data/obj/airboat.obj

And the .mtl file for textures is available at:

https://people.sc.fsu.edu/~jburkardt/data/obj/vp.mtl

NOTES: The colour bronze has to be changed to brass in the .obj file for colours to render properly.
The vp.mtl file must be renamed to airboat.mtl and be placed next to the airboat.obj file for colours to render properly.

This is very much a work in progress. OpenGL support is untested, and much of the OBJ file spec is not yet implemented.
The OBJ file specifications can be found here: http://paulbourke.net/dataformats/obj/
In the near future, I'll add a checklist of stuff that's yet to be implemented from the .obj and .mtl file spec.

Reviewer Checklist

  • The PR title is descriptive enough for the changelog, and the PR is labeled correctly
  • If applicable: newly added non-private functions and classes have a docstring including a short summary and a PARAMETERS section
  • If applicable: newly added functions and classes are tested

@Aathish04 Aathish04 added needs discussion Things which needs to be discussed before implemented. new feature Enhancement specifically adding a new feature (feature request should be used for issues instead) labels Sep 9, 2021
@markromanmiller markromanmiller removed their request for review September 10, 2021 16:38
@markromanmiller
Copy link
Collaborator

Hi Aathish! I'm removing my review request because I'm not that active in Manim development right now. I am happy to provide support / guidance for the SVG code, but this looks out of my scope at the moment. (It also looks really cool, best of luck!)

@naveen521kk
Copy link
Member

It looks like there is support for obj files inside of moderngl-window and we depend on it for OpenGL rendering, shouldn't it be easy to reuse it(atleast for OpenGL rendering)?

@Darylgolden
Copy link
Member

I agree with @naveen521kk, I think it should be handled by moderngl. Additionally I think rendering obj files is a little too niche of a functionality to have in core.

@Aathish04
Copy link
Member Author

@naveen521kk @Darylgolden

I wanted OBJMobject to be as renderer-agnostic as possible, to save future contributors the hassle of porting it over to Vulcan or some other renderer if that happens in the future.

@Aathish04
Copy link
Member Author

I know it's been a while, but I don't think I'll continue working on this until we've fully sorted out the Cairo-OpenGL renderer business.

@MrDiver
Copy link
Collaborator

MrDiver commented Jun 18, 2022

Further discussion should take place in the discussions tab till it becomes relevant again

@MrDiver MrDiver closed this Jun 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

needs discussion Things which needs to be discussed before implemented. new feature Enhancement specifically adding a new feature (feature request should be used for issues instead)

Projects

Status: Rejected

Development

Successfully merging this pull request may close these issues.

5 participants