# Asymptote: when white isn't white

I'm trying to display a white 3D ball with Asymptote (3D PDF), but it always turns up gray:

import graph3;
import solids;

defaultrender.merge=true;
size(10cm,0);

currentprojection=orthographic(-Z);

//currentlight=light(-10,1,1);
//currentlight=White;
currentlight=Viewport;

draw(unitsphere,rgb(1,1,1));

I understand it's a lighting issue, and I've tried playing with its settings (the lines commented out in my source are some of my attempts), but I never manage to have white be white. If I understand correctly, I need a whiter diffuse component in my light, but I cannot see how to achieve that. And the documentation is not very clear…

This will be part of a molecular model, and the rendering I'm going for it something like this:

• Check out the material in docs. You can try, for example: material surfpen; surfpen.p=new pen[]{white,white,yellow,white}; draw(unitsphere,surfpen); – g.kov Mar 23 '14 at 1:58
• @g.kov: (off topic) Any chance you could throw in an answer to this question? Right now there isn't a viable candidate for the bounty, and I know you're at least as good at these things as I am. – Charles Staats Mar 27 '14 at 14:11
• @Charles Staats (off topic): I sincerely appreciate the offer and I'd like to, as I agree that a translation to Asymptote from TikZ/PSTricks is not difficult in most cases, but I can't promise, sorry. – g.kov Mar 27 '14 at 17:35

As g.kov suggests, you may be better off playing with the material rather than the lighting. In particular, ambient light tends to be rather subtle; you're better off using emissivepen, which essentially adds exactly that color to the entire sphere regardless of the lighting.

import three;

defaultrender.merge=true;
size(10cm,0);

currentprojection=orthographic(-Z);

draw(unitsphere, surfacepen=material(diffusepen=gray(0.5), emissivepen=gray(0.6), specularpen=black) );

The result:

This is probably going to be too white for you, but you can decrease emissivepen and diffusepen as needed. I enclose the code and a change in parameter emissivepen from 1.0 to 0.5 with step of 0.1.

import settings;
outformat="eps";
// interactiveView=false;
// batchView=false;

import three;
size(200);
//currentprojection=orthographic(5,4,3);
//defaultrender=render(compression=Zero,merge=true);
currentlight.background=blue;
material White=material(diffusepen=gray(1.0),emissivepen=gray(1.0));
draw(unitsphere,White);