我试图托管在一个Viewport2DVisual3D表面的WPF的形式。我已经设置了相机,以便控件符合窗口的宽度。默认的几何图形将整个窗体映射到一个正方形的面上,所以有必要进行某种形式的变换以使曲面看起来像普通的二维窗体,而不是垂直拉伸。整体形式看起来不错,但文字不能很好地扩展,它是模糊的,块状的,并且以不同的方式看起来很糟糕。这是我一直在努力,设定纵横比:Viewport2DVisual3D在WPF文字模糊控制
- 一个ScaleTransform3D
- 设置网格定位到合适的宽高比
- 的TextureCoordinates设置到适当的长宽比
的前两个让我得到我想要的结果,除了块状/模糊的文本。我的结论是,字体渲染发生在表单图像被投影到3d表面之后发生缩放,所以无论如何它都会看起来很糟糕。有没有人知道解决这个问题的方法或从一开始就设置它的方法?我不知道很多关于3D图形,刚够基本的数学让相机角度权等
曾在Win 7和XP下测试。
一些我使用的资源:
- http://www.codeproject.com/KB/WPF/ContentControl3D.aspx
- http://pavanpodila.spaces.live.com/blog/cns!9C9E888164859398!151.entry
代码的几个片段:
<Viewport2DVisual3D.Geometry>
<MeshGeometry3D x:Name="FrontFaceGeometry"
Positions="-1,1,0 -1,-1,0 1,-1,0 1,1,0"
TextureCoordinates="0,0 0,1 1,1 1,0"
TriangleIndices="0 1 2 0 2 3"/>
</Viewport2DVisual3D.Geometry>
...
<Grid Width="500" x:Name="FrontFaceGrid">
然后在Window_Loaded例程,例如
var aRatio = FrontFaceGrid.ActualHeight/FrontFaceGrid.ActualWidth;
FrontFaceGeometry.Positions[0] = new System.Windows.Media.Media3D.Point3D(-1, aRatio, 0);
FrontFaceGeometry.Positions[1] = new System.Windows.Media.Media3D.Point3D(-1, -aRatio, 0);
FrontFaceGeometry.Positions[2] = new System.Windows.Media.Media3D.Point3D(1, -aRatio, 0);
FrontFaceGeometry.Positions[3] = new System.Windows.Media.Media3D.Point3D(1, aRatio, 0);
您正在使用什么版本的.NET的? – 2010-11-12 17:32:21
我在.NET 4.0上。 – flatline 2010-11-12 18:12:37
你试过SnapsToDevicePixels =“True” – 2012-11-05 06:09:49