What does "emissive" in Asymptote do?
In Asymptote, a pen
object includes certain properties (most notably, color) that are used to draw lines and fill areas. A material
object (defined in three_light.asy
) is used to color surfaces and includes, roughly, three different pens. To understand these, keep in mind that an Asymptote 3d picture comes equipped with "lighting", which includes one or more light sources (specifying direction and strength) and an ambient light (strength only, no direction; it's "from everywhere.").
diffusepen
: The way the object interacts with light sources. Portions of the surface aimed directly at the light source show up exactly this color; the color gradually fades to black as the surface approaches a 90 degree angle to the light source.specularpen
: The extent to which the object behaves like a mirror. This pen only affects portions of the surface aimed directly at the light source (or close to it).emissivepen
: Object coloring that is completely independent of the lighting. A surface colored withemissivepen=red
and no other pens will show up completely red no matter what direction it is aimed.
If more than one pen is set, then the colors are added together to produce the final result.
There are three reasonably convenient ways to produce a material
object (typically for the surfacepen
parameter of a draw
command):
The full constructor:
material(pen diffusepen=black, pen emissivepen=black, pen specularpen=mediumgray, real opacity=opacity(diffusepen), real shininess=defaultshininess, real metallic=defaultmetallic, real fresnel0=defaultfresnel0)
Note that all the parameters are optional.
- A
pen
object can be cast to amaterial
object. If you pass in the penp
, it gets cast tomaterial(diffusepen=p)
. Thus, thediffusepen
will bep
, thespecularpen
will bemediumgray
, and the other two pens will not contribute. - The
emissive
wrapper: ifp
is a pen, thenemissive(p)
produces amaterial
withemissivepen=p
(andopacity
taken fromopacity(p)
), but no other pens contribute. This is convenient if you want, say, a yellow polygon that will not fade to black when the lighting changes.