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

简介: 原文:WPF 3D中多个模型如何设置某一个在最前? 问题:我们的模型包括导入的3D solid模型和axis坐标轴模型,当模型旋转的时候,3D会将axis挡住。
原文: 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 .

目录
相关文章
WPF界面异常:未将对象引用设置到对象实例
WPF界面异常:未将对象引用设置到对象实例
WPF TreeView设置所有节点默认展开
WPF TreeView设置所有节点默认展开
WPF中给TextBox/TextBlock设置提示文本
WPF中给TextBox/TextBlock设置提示文本
WPF中给TextBox/TextBlock设置提示文本
|
C#
WPF Image Source 设置相对路径图片
原文:WPF Image Source 设置相对路径图片   BitmapImage bt = new BitmapImage(new Uri("Images\\3_u10484.png", UriKind.Relative));this.Img1.Source = bt;
3815 0
|
C# Windows 图形学
优化WPF 3D性能
原文:优化WPF 3D性能 Maximize WPF 3D Performance .NET Framework 4.5   As you use the Windows Presentation Foundation (WPF) to build 3D contr...
1316 0
|
C#
WPF DataGrid 每行ComboBox 内容不同的设置方法
原文:WPF DataGrid 每行ComboBox 内容不同的设置方法 ...
1049 0
|
C# 小程序
WPF 3D变换应用
原文:WPF 3D变换应用  WPF可以提供的3D模型使我们可以轻松地创建3D实体,虽然目前来看还很有一些性能上的问题,不过对于一些简单的3D应用应该是可取的,毕竟其开发效率高,而且也容易上手。         下面给大家演示的是使用在WPF 3D上实现视角变换,通过鼠标拖动来变换观察视角,通过滚轮来放缩视距。
703 0
|
C# Windows
WPF 设置类库项目为启动项,设置窗体跟随。
原文:WPF 设置类库项目为启动项,设置窗体跟随。 1、添加用于启动的类Program.cs,需要一个静态的Main函数入口。
983 0
|
C#
WPF 后台C#设置控件背景图片
原文:WPF 后台C#设置控件背景图片 以前的程序中有做过,当时只是记得uri很长一大段就没怎么记。今天有人问了也就写下来。
1995 0