首页 技术 正文
技术 2022年11月20日
0 收藏 896 点赞 3,978 浏览 964 个字

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

问题:我们的模型包括导入的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 .

相关推荐
python开发_常用的python模块及安装方法
adodb:我们领导推荐的数据库连接组件bsddb3:BerkeleyDB的连接组件Cheetah-1.0:我比较喜欢这个版本的cheeta…
日期:2022-11-24 点赞:878 阅读:9,077
Educational Codeforces Round 11 C. Hard Process 二分
C. Hard Process题目连接:http://www.codeforces.com/contest/660/problem/CDes…
日期:2022-11-24 点赞:807 阅读:5,552
下载Ubuntn 17.04 内核源代码
zengkefu@server1:/usr/src$ uname -aLinux server1 4.10.0-19-generic #21…
日期:2022-11-24 点赞:569 阅读:6,401
可用Active Desktop Calendar V7.86 注册码序列号
可用Active Desktop Calendar V7.86 注册码序列号Name: www.greendown.cn Code: &nb…
日期:2022-11-24 点赞:733 阅读:6,176
Android调用系统相机、自定义相机、处理大图片
Android调用系统相机和自定义相机实例本博文主要是介绍了android上使用相机进行拍照并显示的两种方式,并且由于涉及到要把拍到的照片显…
日期:2022-11-24 点赞:512 阅读:7,813
Struts的使用
一、Struts2的获取  Struts的官方网站为:http://struts.apache.org/  下载完Struts2的jar包,…
日期:2022-11-24 点赞:671 阅读:4,896