TransWikia.com

3D Graphics are dark

Mathematica Asked by yundong ren on December 1, 2020

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

3 Answers

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

Answered by b3m2a1 on December 1, 2020

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!

Answered by Alexei Boulbitch on December 1, 2020

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

Answered by murray on December 1, 2020

Add your own answers!

Ask a Question

Get help from others!

© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP