7
$\begingroup$

In Mathematica 12.1 if I try use Opacity less than 1, it does not work.

Graphics3D[{Opacity[0.1],Sphere[]}]

Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}, PlotStyle -> Opacity[0.8]]

Even if I try to execute Opacity-related example from the documentation it does not work. I am using Mathematica 12.1 in Linux by the way.

screenshot

$\endgroup$
9
  • 3
    $\begingroup$ Maybe provide some code of what you are trying to do, what you expect, an what you are seeing. Simply saying "it doesn't work", doesn't give anyone much to work off! $\endgroup$ – Q.P. May 10 '20 at 17:50
  • $\begingroup$ Sorry. Its actually opacity under Plot3D or Graphics3D not working. Say, Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}, PlotStyle -> Opacity[0.8]] this code , it returns a blank box , but changing opacity to 1 it shows the sphere $\endgroup$ – puppet22 May 10 '20 at 17:52
  • 1
    $\begingroup$ This looks like one of those times where a screenshot, as well as the code you are evaluating (in copyable form) should be supplied. $\endgroup$ – J. M.'s ennui May 10 '20 at 17:54
  • 2
    $\begingroup$ When I said copyable code, this is like the code from your comment that I added to your question. Next time, please do this yourself. $\endgroup$ – J. M.'s ennui May 10 '20 at 18:00
  • 1
    $\begingroup$ You should contact Wolfram with this. $\endgroup$ – Szabolcs May 10 '20 at 18:28
5
$\begingroup$

I was able to fix the Opacity issue in Manjaro KDE (Kernel: 5.4.40-1) going to the Option Inspector to modify the settings for:

Graphics Options > RenderingOptions > "Graphics3DRenderingEngine"

to change from > "Automatic" to > "Mesa". The other option available: "OpenGL" doesn't work and I do not really know whether it should or what does it mean. Also a font rendering issue for the labels in Plot3D was fixed in this way.

Additional comments related to this issue are more than welcome.

$\endgroup$
4
  • 1
    $\begingroup$ There's also the old solution of starting Mathematica as mathematica -mesa from e.g. the command line. $\endgroup$ – J. M.'s ennui May 22 '20 at 1:51
  • $\begingroup$ For me the -mesa solution did work as well but the rendering was quite underwhelming. If you have a dedicated Nvidia GPU like I do, you can make use of bumblebee (uses dGPU only on demand to save power). Just start the binary via command line with primusrun mathematica &. $\endgroup$ – PandaScience Jun 21 '20 at 19:59
  • 1
    $\begingroup$ This solution didn't actually work for me $\endgroup$ – InertialObserver Aug 11 '20 at 0:32
  • $\begingroup$ To save someone some time: Option inspector is by default opened using Shift+Ctrl+O. You need to set "shop options value" to global if you want to fix this globally. It works for me Ubuntu 20.04. I am not sure whether it has a detrimental effect on rendering time and output. $\endgroup$ – Kvothe Dec 10 '20 at 16:26
4
$\begingroup$

Your code works fine on version 12.1 with my Mac, using OS Catalina 10.15.3:

Graphics3D[{Opacity[0.1], Sphere[]}]

enter image description here

Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2}, PlotStyle -> Opacity[0.8]]

picture

$\endgroup$
10
  • $\begingroup$ I am using Linux (Manjaro 20.0). Here the opacity is not working! $\endgroup$ – puppet22 May 10 '20 at 18:23
  • 8
    $\begingroup$ Sounds like you should inform Wolfram Research. $\endgroup$ – DavidC May 10 '20 at 19:11
  • 1
    $\begingroup$ Or change the Linux distribution. This works all fine on Mathematica 12.1 on CentOS and Ubuntu. $\endgroup$ – Rolf Mertig May 12 '20 at 13:37
  • $\begingroup$ @RolfMertig what Linux kernel version are you using ? $\endgroup$ – puppet22 May 13 '20 at 21:30
  • $\begingroup$ @puppe22: 2.6 and 5.0. I doubt it has anything to do with the kernel version. Maybe your you windows manager or your graphics card matters? XFCE or what do you use? $\endgroup$ – Rolf Mertig May 13 '20 at 22:10
3
$\begingroup$

I contacted Wolfram, and they told me another workaround that doesn't require using the -mesa option (which removes antialiasing and is slow since it renders on the CPU). You can use HardwareDepthPeeling like in:

Style[
  Plot3D[Sin[x + y^2], {x, -3, 3}, {y, -2, 2},PlotStyle -> Opacity[0.3]],
  RenderingOptions -> {"3DRenderingMethod" -> "HardwareDepthPeeling"}
]

This can be enabled globally in the Options Inspector:

Edit -> Preferences -> Advanced -> Open Option Inspector
Graphics Options -> RendreingOptions -> "3DRenderingMethod" -> "HardwareDepthPeeling"
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.