[Tex/LaTex] Asymptote: when white isn’t white

3dasymptote

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

enter image description here

import graph3;
import solids;

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

currentprojection=orthographic(-Z);

//currentlight=Headlamp;
//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:

enter image description here

Best Answer

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:

Related Question