5
$\begingroup$

System: Mathematica 9, Windows 7.

I want to assign a polygon a color in such a way that it is rendered in that color irrespective of any ambient light sources. In other words I want Yellow to be Yellow no matter whether it gets rotated to the top, left, right, front ...

I once figured out how to do this in version 3, when I produced functions to work on a Rubik cube (when it is kinda essential that lightsources won't distort the colors). IIRC I was to turn Lighting -> None, and Shading -> True. But that does not work with version 9. For example Lighting -> None gives all black. Lighting->"Neutral" was a bit better, but still produces like different GreyLevels. F1 gives me scores of nice looking examples of achieving neat effects, but, infuriatingly, no way of deciding on the colors myself. Surely one exists, but I just couldn't coerce on-line help to tell me how, because I don't know the correct buzzword.

$\endgroup$
5
  • 1
    $\begingroup$ maybe Glow? $\endgroup$
    – kglr
    Commented Jan 26, 2015 at 14:00
  • $\begingroup$ Thank you, @kguler. Setting Lighting->None, and replacing, for example, Red with the Glow[Red] in the Polygon specification does exactly this! Do you mind posting that as an answer? $\endgroup$ Commented Jan 26, 2015 at 14:04
  • $\begingroup$ just posted an answer using that combination. $\endgroup$
    – kglr
    Commented Jan 26, 2015 at 14:09
  • 1
    $\begingroup$ @JyrkiLahtonen I wasn't sure what "irrespective of any ambient light sources" meant -- in particular, whether you were referring specifically to the technical Lighting specification "Ambient". It seemed from your subsequent trials that you were searching for a solution using Lighting. $\endgroup$
    – Michael E2
    Commented Jan 26, 2015 at 14:11
  • $\begingroup$ @MichaelE2: Not sure about terminology. Sorry about the confusion. $\endgroup$ Commented Jan 26, 2015 at 18:42

2 Answers 2

4
$\begingroup$

Using @MichaelE2's example, a combination of Glow and Lighting->None produces a similar picture:

Show[PolyhedronData["Icosahedron"] /. 
  Polygon[p_] :> MapIndexed[{Glow[Hue[Mod[3*First[#2], 20]/20]], Polygon[#1]} &, p],
  Lighting -> None]

enter image description here

Alternatively:

A surface can be specified as having an absolute color col by giving the combination of directives Glow[col], Black, and Specularity[0]. (see: Glow >> Details)

Show[PolyhedronData["Icosahedron"] /. 
  Polygon[p_] :>  MapIndexed[{Glow[Hue[Mod[3*First[#2], 20]/20]], Black, Polygon[#1]} &, p]]

enter image description here

$\endgroup$
6
$\begingroup$

Perhaps Lighting -> {{"Ambient", White}?

Show[
 PolyhedronData["Icosahedron"] /. 
  Polygon[p_] :> 
   MapIndexed[{Hue[Mod[3*First[#2], 20]/20], Polygon[#1]} &, p],
 Lighting -> {{"Ambient", White}}
 ]

Mathematica graphics

$\endgroup$

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.