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

render problem 3d camera distance #975

Open
n-0 opened this issue Jan 28, 2021 · 4 comments
Open

render problem 3d camera distance #975

n-0 opened this issue Jan 28, 2021 · 4 comments
Labels
issue:bug Something isn't working... For use in issues

Comments

@n-0
Copy link

n-0 commented Jan 28, 2021

Description of bug / unexpected behavior

If setting the distance in camera orientation too close to 3d axes
white frames are rendered and the axes are curved.

This can be bypassed by setting the distance further away
or probably with some tricks in scaling, but can be surprising and hard
to debug also.

Expected behavior

Distance of 3d camera shouldn't create rendering problems and not bend the axes.

How to reproduce the issue

Code for reproducing the problem
   def construct(self):

        self.set_camera_orientation(
            phi=80 * DEGREES,
            theta=45*DEGREES,
            distance=2 # causes trouble
        )

        axes = ThreeDAxes()

        s = Sphere()
        
        self.add(axes)
        self.play(Write(s))
        self.begin_ambient_camera_rotation(rate=0.2)
        self.wait(10)

Additional media files

Images/GIFs

bug_distance_camera

Logs

Everything goes fine even with log level debug.

System specifications

System Details
  • OS Fedora 33
  • RAM: 16GB
  • Python version: 3.9.1
FFMPEG

Output of ffmpeg -version: 4.3.1

@n-0 n-0 added the pr:bugfix Bug fix for use in PRs solving a specific issue:bug label Jan 28, 2021
@huguesdevimeux
Copy link
Member

Thanks for the report! Sorry to be so late to respond.

This is in fact very weird, probably related to how manim handles rotation in 3d. This an hard issue.

Just a question, are the kinf of flashs in the gif you provided intentional?

@n-0
Copy link
Author

n-0 commented Feb 8, 2021

No worries as stated you can trick yourself around this issue.

The flashes weren't intentional and only existent if
the distance was too small. They seem similar to the ones,
which are produced if the camera is inside an object.
Maybe the camera is hitting the axis or the ball.

@huguesdevimeux
Copy link
Member

Thanks for the clarification. I don't know if this will be fixed soon, I hope you found a workaround

friedkeenan pushed a commit to friedkeenan/manim that referenced this issue Feb 10, 2021
@andryandrew
Copy link

andryandrew commented Feb 19, 2021

I think the distance property might just not be what it seems (see: #899 (comment)).

Anyway, the flashing issue and curved axes are caused by having objects in the scene with z value too close to the distance value, and can be fixed by setting exponential_projection=True which smooths them out:

class DebugCamera(ThreeDScene):
    def construct(self):
        
        self.renderer.camera.exponential_projection=True

        self.set_camera_orientation(phi=80*DEGREES, theta=45*DEGREES, distance=2)

        axes = ThreeDAxes()
        s = Sphere()
        
        self.add(axes, s)
        self.begin_ambient_camera_rotation(rate=0.2)
        self.wait(10)
Click for Video
DebugCamera.mp4

@jsonvillanueva jsonvillanueva added issue:bug Something isn't working... For use in issues and removed pr:bugfix Bug fix for use in PRs solving a specific issue:bug labels Apr 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
issue:bug Something isn't working... For use in issues
Projects
Status: 🆕 New
Development

No branches or pull requests

4 participants