10
$\begingroup$

I have just installed 12.1 and was trying to have a 3D plot. The problem I have is that the color of the 3D plot is very dark (attached figure 1). The color of the graphic will light up only if I click on the plot and try to manipulate it (attached figure 2). I am not sure how to adjust it and I don't think it was a lighting problem. Is it a version 12.1 thing?enter image description here

enter image description here

$\endgroup$
15
  • 1
    $\begingroup$ OS ? Code? etc...? $\endgroup$
    – ktm
    Mar 20, 2020 at 18:20
  • 2
    $\begingroup$ Can you please edit the requested information into the question (in particular, OS, OS version, graphics hardware)? Otherwise people will not be able to help. No, it is not darker on macOS. $\endgroup$
    – Szabolcs
    Mar 20, 2020 at 18:33
  • 1
    $\begingroup$ I can't reproduce locally either (12.1, Windows) so you probably want to contact [email protected] $\endgroup$
    – ktm
    Mar 20, 2020 at 18:36
  • 1
    $\begingroup$ Still not working after reinstalling... I have contacted WolframResearch directly for help $\endgroup$ Mar 20, 2020 at 19:52
  • 2
    $\begingroup$ This question needs to be reopened. I contacted Wolfram Support and they have confirmed that this is a issue in MacOS related to the default 'Metal' graphics rendering engine. Switching it to use OpenGL was recommended as a workaround. $\endgroup$
    – heropup
    May 28, 2020 at 19:21

4 Answers 4

7
$\begingroup$

This is a hardware/software issue in the new macOS, I think, and the Metal 3D rendering engine which is now the default.

This comment indicates WRI is aware of the issue.

We can set this option using the "3DRenderingEngine" option to RenderingOptions. This can be done via

SetOptions[$FrontEnd,
  RenderingOptions -> {
    "RenderingEngine" -> <engine>
    }
  ];

or done at the Cell/Notebook level in case WRI patches this for 12.2

Here's what the options do for me

Grid@Transpose@Table[
   {
    o,
    Style[
     Graphics3D[{
       Sphere[]
       }],
     RenderingOptions -> {
       "3DRenderingEngine" -> o
       }
     ]
    },
   {o, {Automatic, "Metal", "OpenGL", "Mesa"}}
   ]

enter image description here

"OpenGL" is faster than "Mesa", but is Unix only. On the other hand, I think Windows doesn't have this issue, so "OpenGL" seems to be the way to go.

I just set

SetOptions[$FrontEnd,
  RenderingOptions -> {
    "RenderingEngine" -> "OpenGL"
    }
  ];

so that I don't need to deal with this again until I update Mathematica

$\endgroup$
1
$\begingroup$

I see something similar, under macOS, with:

Plot3D[Sin[1.75 (x + y)], {x, -5, 5}, {y, -5, 5}]

Original image

I think it's just a matter of the direction of the light source(s).

Rotating the plot manually with the mouse, or changing the ViewPoint will lighten the plot.

Rotated image

$\endgroup$
3
  • $\begingroup$ It is not the ViewPoint I have determined that it is a problem related to the external monitor. Without connecting to my monitor (Dell S2716DG) it works fine, once it is connected, the color is dark. $\endgroup$ Mar 20, 2020 at 23:32
  • $\begingroup$ I have changed to another monitor, the problem persists. $\endgroup$ Mar 20, 2020 at 23:51
  • $\begingroup$ @Szabolcs Do have this problem when connected to external monitor? $\endgroup$ Mar 20, 2020 at 23:52
1
$\begingroup$

You might try to play with the Lighting option. For example, like this:

Plot3D[Sin[1.75 (x + y)], {x, -5, 5}, {y, -5, 5}, 
 Lighting -> {{"Point", Yellow, {-4, -5, 8}}}]

enter image description here

and try to play with the position of the point light source.

Another possibility is the "Neutral" light source

Plot3D[Sin[1.75 (x + y)], {x, -5, 5}, {y, -5, 5}, 
 Lighting -> "Neutral"]

enter image description here

or a "Directional" one

Plot3D[Sin[1.75 (x + y)], {x, -5, 5}, {y, -5, 5}, 
 Lighting -> {{"Directional", 
    RGBColor[1, 0.5, 0.3], {{5, 5, 7}, {5, 9, 0}}}}]

enter image description here

Have fun!

$\endgroup$
1
$\begingroup$

Plotting with Lighting -> {White} gets rid of part of the problem. Namely, when clicked on and moved, the lighting looks no different than when the mouse is not used. Unfortunately, the lighting is so diffuse that the shading is also removed, but at least one can see the surface equally well in all positions.

Plot3D[Sin[1.75 (x + y)], {x, -5, 5}, {y, -5, 5}, Lighting -> {White}]

enter image description here

Next, let us compromise with another lighting trick; Lighting -> {{"Ambient", White}, {"Point", Brown, {1, 1, 1}}}], and remember, this only pertains to a newer Mac with Mathematica 12.1. This is now somewhat different when dragged and still, but at least is is not so dark as to have no contrast.

Plot3D[Sin[1.75 (x + y)], {x, -5, 5}, {y, -5, 5}, Lighting -> {{"Ambient", White}, {"Point", Brown, {1, 1, 1}}}]

enter image description here

Putting in multiple point light sources still shows different coloring while being rotated than when there is no mouse capture, but at least one can then see the object better at rest:

Plot3D[Sin[1.75 (x + y)], {x, -5, 5}, {y, -5, 5}, Lighting -> {{"Point", Brown, Scaled[{2, 0, 0}]}, {"Point", Orange, 
Scaled[{0, -2, 0}]}, {"Point", Orange, Scaled[{0, 0, 2}]}}]

enter image description here

Other solution, use an old copy of Mathematica, e.g., v10.3 enter image description here

$\endgroup$
1
  • $\begingroup$ Definitely yours should be chosen as a main answer. Thanks $\endgroup$ Jan 8, 2023 at 13:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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