2

This question already has an answer here:

I want to use Asmptote to draw a small triangle in red inside a unit cube. Here is my code:

settings.outformat="pdf";
settings.prc = false;
settings.render = 0;
defaultpen(fontsize(10pt));
size(4cm,0);
import three;
draw(unitbox);
triple p0 = (0.8,1,0);
triple p1 = (1,0.8,0);
triple p2 = (1,1,0.2);
draw(surface(p0 -- p1 -- p2 -- cycle),red);
draw(p0 -- p1 -- p2 -- cycle);

However, color of the triangle is not desired. How could I resolve it? Thanks in advance!

enter image description here

marked as duplicate by TeXnician, Stefan Pinnow, Troy, CarLaTeX, Zarko May 24 '17 at 16:09

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Change "red" to "emissive(red)". Your triangle looks black because it has no direct light shining on it... it is in shadow. The "emissive" wrapper makes it "emit" light. – James May 24 '17 at 14:40

Browse other questions tagged or ask your own question.