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 with emissivepen=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 a material object. If you pass in the pen p, it gets cast to material(diffusepen=p). Thus, the diffusepen will be p, the specularpen will be mediumgray, and the other two pens will not contribute.
  • The emissive wrapper: if p is a pen, then emissive(p) produces a material with emissivepen=p (and opacity taken from opacity(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.

Tags:

Asymptote