打开APP
userphoto
未登录

开通VIP,畅享免费电子书等14项超值服

开通VIP
WPF 3D中多个模型如何设置某一个在最前?

WPF 3D中多个模型如何设置某一个在最前?

分类: WPF 3D488人阅读评论(0)收藏举报
 

问题:我们的模型包括导入的3D solid模型和axis坐标轴模型,当模型旋转的时候,3D会将axis挡住。

期望:axis一直在最前面,不会被3D挡住。

方法:

(1) 将模型设置为透明,<SolidColorBrush Color="#3333CC" Opacity="0.8"/>,同时,将axis使用EmissiveMaterial。

这样实现可以在旋转后看到axis,但是这种方法并没有让axis放在最前,效果并不好,所以需要继续找到其他方法。

(2) 看到有些文章中说到z index,在控件中可以使用它设置层次,但是在模型中没有找到类似方法,不知道如何使用。

 

下面是我在微软论坛上提问获得的答案:

Hello,

It seems that you wants to see through a 3D object (for example, a cube), to see the object behind it. If this is the case, the only solution is to make the cube semi-transparent or fully transparent. This is similar to the real world. If a table is behind the wall of a house, you won't be able to see it. But if it is behind a window, you can still see it.

 

One thing to note is how WPF 3D handles transparency. In the above sample, if the windows comes before the table in the visual tree, you still won't be able to see through it. You have to put the non-transparent elements before the transparent ones. There is a helper class which can help you to solve this problem. Have a look at http://blogs.msdn.com/pantal/archive/2007/07/23/sorting-for-wpf-3d-transparency.aspx .

本站仅提供存储服务,所有内容均由用户发布,如发现有害或侵权内容,请点击举报
打开APP,阅读全文并永久保存 查看更多类似文章
猜你喜欢
类似文章
【热】打开小程序,算一算2024你的财运
英文版《好久不见》
英文版《好久不见》,好听哭了~
Nat. Mach. Intell. | 人工智能的透明度和可重复性
含有behind的重要短语
【词汇】同义词辨析 after,behind (在)后面
WPF中如何高效绘制曲线
更多类似文章 >>
生活服务
热点新闻
分享 收藏 导长图 关注 下载文章
绑定账号成功
后续可登录账号畅享VIP特权!
如果VIP功能使用有故障,
可点击这里联系客服!

联系客服