4
$\begingroup$

It looks to me like ChromaticityPlot3D has some default lighting, but unlike most Graphics3D functions the Lighting option doesn't seem to have any effect.

However, the documentation states "ChromaticityPlot3D accepts all Graphics3D options with the following additions and changes: ...".

Any ideas how to affect the lighting? Is it possible to produce a Graphics3D object from the chromaticity plot? I am trying to achieve unshaded lighting like Lighting -> {{"Ambient", White}}.

$\endgroup$
  • $\begingroup$ Lighting -> "Neutral" is the default. Why is it not suitable for you? $\endgroup$ – J. M. is away Jul 19 '16 at 18:21
  • $\begingroup$ J.M.: What is "suitable", this is just a question of aesthetics / "readability" isn't it? Anyway in my specific case the darkening of the colours causes a problem and I would like Lighting -> none, as to be able to see different views of the surface (projections) as you would in a typical 2D plot, with a uniform / normalized lightness. The darkening of the colours makes it very difficult to see the chromaticity. $\endgroup$ – ddd Jul 19 '16 at 18:29
  • $\begingroup$ Okay, maybe a screenshot showing this "darkening" might help. "Neutral" corresponds to using white lights in a few places, and some of those places are not lit (maybe that's what you're bothered by)? Lighting -> None will not help, because... what do you expect to see without lights? ;) $\endgroup$ – J. M. is away Jul 19 '16 at 18:36
  • $\begingroup$ Sorry, I had wrongly understood the behaviour of None, but anyway what I want is pure diffuse colour, no shading. I updated the original question to clarify. $\endgroup$ – ddd Jul 19 '16 at 20:29
  • $\begingroup$ @ddd - This can be done by the method below $\endgroup$ – Jason B. Jul 19 '16 at 20:34
5
$\begingroup$

If you look at the InputForm of ChromaticityPlot3D[{"WideGamutRGB", "sRGB"}] you'll find several spots where it says Lighting -> "Neutral"

So if you want to change that, you'll have to modify the output of ChromaticityPlot3D using a replacement rule. Here is an extreme example, one that totally ruins the plot but shows how to change the lighting,

ChromaticityPlot3D["WideGamutRGB"] /. 
   Rule[Lighting, "Neutral"] :> Rule[Lighting, #] & /@ {"Neutral", 
  None, {{"Ambient", White}}}

Mathematica graphics

$\endgroup$
  • 1
    $\begingroup$ Or, keeping your fingers crossed, "Neutral" :> {{"Directional", RGBColor[0, 1, 0], {{5, 5, 4}, {5, 5, 0}}}} :) $\endgroup$ – Kuba Jul 19 '16 at 18:59
  • $\begingroup$ But what if they have some other setting with that value? :-) $\endgroup$ – Jason B. Jul 19 '16 at 19:01
  • 1
    $\begingroup$ I told you to keep fingers crossed while doing that :) $\endgroup$ – Kuba Jul 19 '16 at 19:08
  • 1
    $\begingroup$ Thanks for suggesting to look at the InputForm. ChromaticityPlot3D["sRGB"] /. (Lighting -> "Neutral") :> Lighting -> {{"Ambient", White}} gets me what I was after. I think really the proper solution is for Mathematica to not override the Lighting option though. $\endgroup$ – ddd Jul 19 '16 at 20:48
3
$\begingroup$

One could override the setting for each polygon group (or GraphicsGroup[]):

cp /. p_Polygon :> {Lighting -> {{"Ambient", White}}, p}
cp /. gg_GraphicsGroup :> {Lighting -> {{"Ambient", White}}, gg}

Mathematica graphics


Update: Addendum.

While Lighting shows up in Options@ChromaticityPlot3D, it is not listed among the options in the docs for ChromaticityPlot3D. However, it inherits the setting for Lighting from ParametricPlot3D before it is embedded as styling in the graphics primitives: If the setting is not Automatic, then ChromaticityPlot3D won't override it.

With[{opts = Options[ParametricPlot3D]},
 Internal`WithLocalSettings[
  SetOptions[ParametricPlot3D, Lighting -> {{"Ambient", White}}],
  ChromaticityPlot3D[{"WideGamutRGB", "sRGB"}],
  SetOptions[ParametricPlot3D, opts]
  ]
 ]
(* same plot as above *)

See this answer or this one for more on Internal`WithLocalSettings. In this case one might simply handle things oneself as follows:

  SetOptions[ParametricPlot3D, Lighting -> {{"Ambient", White}}];
  ChromaticityPlot3D[{"WideGamutRGB", "sRGB"}]
  SetOptions[ParametricPlot3D, Lighting -> Automatic];
$\endgroup$
  • $\begingroup$ Nice detective work! I would even call this a bug, since the docs say that it can take any options that Graphics3D takes. But perhaps it's intentional since the whole point of the plot is to show the colors in as correct a fashion as possible. $\endgroup$ – Jason B. Jul 19 '16 at 22:34
  • $\begingroup$ Thanks! My feeling is that it's probably intentional. Oddly, the default option setting is Lighting -> {{"Ambient", White}}, but it is changed to neutral plus transparency for color spaces. I guess the advantage of "Neutral" is that the orientation of a surface and the surfaces of the overlapping colorspaces are easier to distinguish, and the disadvantage is that the color is mixed with gray. (Not sure why users are not allowed to mess with it, with the options Lighting, PlotStyle, and ColorFunction. PlotTheme -> "Monochrome" is an interesting special case.) $\endgroup$ – Michael E2 Jul 20 '16 at 14:34

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.