問題:我們的模型包括導(dǎo)入的3D solid模型和axis坐標(biāo)軸模型,當(dāng)模型旋轉(zhuǎn)的時(shí)候,3D會(huì)將axis擋住。 期望:axis一直在最前面,不會(huì)被3D擋住。 方法: (1) 將模型設(shè)置為透明,<SolidColorBrush Color="#3333CC" Opacity="0.8"/>,同時(shí),將axis使用EmissiveMaterial。 這樣實(shí)現(xiàn)可以在旋轉(zhuǎn)后看到axis,但是這種方法并沒有讓axis放在最前,效果并不好,所以需要繼續(xù)找到其他方法。 (2) 看到有些文章中說到z index,在控件中可以使用它設(shè)置層次,但是在模型中沒有找到類似方法,不知道如何使用。
下面是我在微軟論壇上提問獲得的答案:
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./pantal/archive/2007/07/23/sorting-for-wpf-3d-transparency.aspx . |
|