1

I searched in the Asymptote documentation and found that material is handled as a structure in three_light.asy that has the following definition:

struct material {
pen[] p; // diffusepen,ambientpen,emissivepen,specularpen
real opacity;
real shininess;
void operator init(pen diffusepen=black, pen ambientpen=black,
                 pen emissivepen=black, pen specularpen=mediumgray,
                 real opacity=opacity(diffusepen),
                 real shininess=defaultshininess) {
p=new pen[] {diffusepen,ambientpen,emissivepen,specularpen};
this.opacity=opacity;
this.shininess=shininess;
}

The document says these are used to

implement OpenGL-style lighting, based on the Phong-Blinn specular model.

Where do I get information/examples of how to define the parameters? For example, how do I take advantage of this to define a glass material and draw a glass cup/cube that has a certain amount of deflection/transparency? Or are there available material definitions that I can start with?

  • tex.stackexchange.com/a/243483/484 has a lot of the info you are looking for. You can play around with opacity (which was not discussed there), but fair warning: transparent surfaces tend to look pretty bad in Asymptote. And I doubt the phong-blinn specular model could ever produce good looking glass -- that probably requires ray tracing. – Charles Staats Oct 1 '18 at 16:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.