如何让Mathics3生成的Asymptote 3D图形更贴近Mathematica风格
调整Mathics3的Asymptote输出以匹配Mathematica的Plot3D效果
我正尝试让Mathics3生成的Asymptote输出更贴近Mathematica的效果。以Mathematica执行Plot3D[Sin[x y], {x, 0, 3}, {y, 0, 3}]的输出为参照,目前Mathics3生成的对应输出在颜色和阴影效果上存在差异,初步目标是让这两部分与Mathematica默认效果匹配。
以下是当前Mathics3生成的部分Asymptote代码:
import three; import solids; import tube; size(6.6667cm, 6.6667cm); currentprojection=perspective(1.3,-2.4,2.0); currentlight=light(rgb(0.5,0.5,1), specular=red, (2,0,2), (2,2,2), (0,2,2)); // Polygon3DBox path3 g=(0,0,0)--(0,0.033333,0)--(0.033333,0,0)--cycle;draw(surface(g), rgb(1, 1, 1), nullpen); // Polygon3DBox path3 g=(0,0.033333,0)--(0.033333,0,0)--(0.033333,0.033333,0.002)--cycle;draw(surface(g), rgb(1, 1, 1), nullpen); ... draw(((0.0,0.0,0.14000061891403817)--(0.0,0.025,0.14000061891403817)), rgb(0, 0, 0)+linewidth(1.2)); draw(((0.0,0.0,0.16000070733032934)--(0.0,0.025,0.16000070733032934)), rgb(0, 0, 0)+linewidth(1.2)); draw(((0.0,0.0,0.18000079574662048)--(0.0,0.025,0.18000079574662048)), rgb(0, 0, 0)+linewidth(1.2));
初步调整方向(针对颜色和阴影)
- 优化光照参数:替换当前
currentlight设置,使用更贴近Mathematica的柔和光源,调整光源颜色、位置及高光属性,移除突兀的红色高光 - 修改表面着色:将固定白色表面
rgb(1,1,1)改为基于函数z值的渐变配色,匹配Mathematica默认的冷暖色映射逻辑 - 调整网格线样式:把黑色粗网格线改为浅灰色细线,降低
linewidth值,让网格线更柔和,避免抢占主体图形的视觉焦点
注:此前相关赏金已结束,若有可行方案会重新设置并发放。
内容的提问来源于stack exchange,提问作者rocky
相关产品推荐
相关产品推荐

