ManimCommunity / ManimCommunity/manim

Depth testing issue where it shouldn't happen

Open
#1,878 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

issue:bug opengl
Dominant language
Python
Stars
40.9k
Forks
3.1k
Avg merge
3d 12h
Merged PRs (30d)
25

Description

Description of bug / unexpected behavior

An OpenGLLine and an OpenGLSurface don't work together as they should even though depth_test=True is passed to both.

Bildschirmfoto 2021-08-07 um 11 52 07

Expected behavior

The green line in the example should be seen in total with the exception of the origin. When moving the camera around you can see other angles where the line is indeed completely above.

How to reproduce the issue

class SimpleSurface(Scene):
    def construct(self):
        frame = self.renderer.camera
        frame.set_euler_angles(theta=-30*DEGREES, phi=70*DEGREES)

        axes = ThreeDAxes()

        line = OpenGLLine(LEFT*5, RIGHT*5, depth_test=True)
        line2 = OpenGLLine(UP*5, DOWN*5, depth_test=True)#.shift(OUT*0.5)
        line2.set_stroke(color=GREEN, width=8)

        saddle = OpenGLSurface(
            lambda u,v: axes.c2p(
                u*np.cos(v),
                u*np.sin(v),
                0.2*u*u*np.cos(2*v)
            ),
            u_range=[0, 3],
            v_range=[0, 2*PI],
            color=BLUE_E,
            depth_test=True
        )

        saddle.mesh = OpenGLSurfaceMesh(saddle, depth_test=True)
        saddle.mesh.set_stroke(WHITE, 1, opacity=1)

        self.play(
            FadeIn(saddle),
            Create(saddle.mesh)
        )
        self.add(line, line2)
        self.interactive_embed()

System specifications

  • OS: macOS Big Sur 11.4
  • RAM: 8 GB 2133 MHz LPDDR3
  • Python version (python/py/python3 --version): 3.9
  • GPU: Intel Iris Plus Graphics 655 1536 MB

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the provided SimpleSurface reproduction with OpenGLLine, OpenGLSurface, and OpenGLSurfaceMesh, then inspect how depth testing is handled in the OpenGL rendering path. Compare the rendered line and surface from multiple camera angles; done means the green line remains visible except at the origin when depth_test=True is used.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
computer-graphics
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.