enthought / mayavi

3D visualization of scientific data in Python
http://docs.enthought.com/mayavi/mayavi/
Other
1.3k stars 284 forks source link

antialiased not working for mlab.screenshot #862

Open JackRBlack opened 4 years ago

JackRBlack commented 4 years ago

I'm using Mayavi in Jupiter notebook on macOS, and just found that, when using the screenshot function, the results are the same whether the antialiased option is on or not:

# draw something with Mayavi
mlab.figure(size=(500, 500))
obj = mlab.test_plot3d()

# call screenshot
a = mlab.screenshot(figure = obj, mode = 'rgba', antialiased=True)
b = mlab.screenshot(figure = obj, mode = 'rgba', antialiased=False)

# check if they are the same
np.max(a - b)

And this returns

0

which means they are exactly the same. Why is the antialiased option not working?

I searched the Mayavi documentations, and found this

obj.scene.anti_aliasing_frames = 8

I have tried to change this value, but nothing happened.

By the way, the rendering is pretty good in "x3d backend":

image

But using screenshot, the result is really a mess:

image

How to solve this problem?

lopsided commented 2 years ago

I'm having this same problem. @JackRBlack did you find any fix/workaround for this?

JackRBlack commented 2 years ago

I think I used matplotlib for antialiasing after acquiring the low-quality screenshot image. I'm not sure if this problem is fixed now because I haven't used mayavi since then.