问题描述
在我的应用程序中,我需要以3D放置绘图环境(即平坦地形),为此,我要在从画布派生的类上绘制网格,然后直接在其上放置线条.
In my application, i need to place the drawing environment (i.e. flat terrain) in 3D, for which I am drawing the grid on a class derived from canvas, and placing lines directly on it.
我正在用这些笔画线:
Pen gridPen = new Pen(Brushes.Black, 0.2); //Pen for drawing basic line
Pen gridPen2 = new Pen(Brushes.Black, 0.5); //pen for drawing the thick line after 5 intervals
// And later the lines are added to a DrawingVisual and that is added to the Canvas using base.AddVisualChild()
// and base,AddLogicalChild()
但是,只要画布尺寸保持在接近2000 x 2000以下,它仍然可以使用,但是当画布尺寸超过3000 x 3000时,网格将失去清晰度,变得模糊,有时甚至看不到某些线条.
But as long as the canvas size remains under almost 2000 x 2000, it remains fine, but when it increases beyond 3000 x 3000 , the grid loses its sharpness, becomes blurred and sometimes some lines become invisible.
如果它变得很大,则所有内容都将变得模糊并且缺少许多行,并且所有内容都会变得奇怪
If it becomes very large, everything is s blurred and many lines are missing and everything is strange
使用Model3DGroup创建的其他模型在任何尺寸上都是清晰的.我正在使用透视相机在viewport3d上查看它,并且在xaml中将Viewport2DVisual3D声明为:
Other models created using Model3DGroup are sharp in any size. I am using perspective camera to view it on viewport3d, and the Viewport2DVisual3D is declared in xaml as:
<Viewport2DVisual3D x:Name="testVisual3d">
<Viewport2DVisual3D.Transform>
<RotateTransform3D>
<RotateTransform3D.Rotation>
<AxisAngleRotation3D Angle="0" Axis="0, 0, 0" />
</RotateTransform3D.Rotation>
</RotateTransform3D>
</Viewport2DVisual3D.Transform>
<Viewport2DVisual3D.Geometry>
<MeshGeometry3D Positions="0,0,0 0,0,100 100,0,100 100,0,0"
TextureCoordinates="0,0 0,1 1,1 1,0" TriangleIndices="0 1 2 0 2 3"/>
</Viewport2DVisual3D.Geometry>
<Viewport2DVisual3D.Material>
<DiffuseMaterial Viewport2DVisual3D.IsVisualHostMaterial="True" Brush="White"/>
</Viewport2DVisual3D.Material>
<!-- <Canvas>
<Button Width="20">Hello, 1D</Button>
<Button >Hello, 2D</Button>
</Canvas> -->
</Viewport2DVisual3D>
如何解决这个问题?包括屏幕截图,
How to fix this issue? Screenshots included,
- 画布尺寸为800 x 800且Viewport2DVisual3D的要点的第一张图片是:
- first image with canvas size 800 x 800 and Viewport2DVisual3D's points are:
<MeshGeometry3D Positions="0,0,0 0,0,100 100,0,100 100,0,0"
<MeshGeometry3D Positions="0,0,0 0,0,100 100,0,100 100,0,0"
<MeshGeometry3D Positions="0,0,0 0,0,100 100,0,100 100,0,0"
<MeshGeometry3D Positions="0,0,0 0,0,100 100,0,100 100,0,0"
如何解决此问题?将来会有更多项目放置在画布上,那么如何解决此问题?
How to fix this issue? In future there'll be more items placed on the Canvas, so how to fix this issue?
屏幕截图:
PerspectiveCamera有
PerspectiveCamera has
FarPlaneDistance="1000"
和
NearPlaneDistance="1"
推荐答案
据我所知,绘图是在WPF中分阶段进行的.从粗糙的或模糊的开始,然后逐渐变得清晰,清晰.此过程受时间限制,这意味着如果显示所有细节所需的时间太长,图像将保持模糊.
As far as I know, drawing happens in stages in WPF. Starting with rough, or blurry and then gradually becoming crisp, clear. This process is time limited, which means that an image stays blurry if it takes too long to display all the details.
我建议:
-检查是否可以为图形设置更长的时间范围,以便绘制更多细节.
- Check whether you can set a longer timeframe for the drawing, to allow more details to be drawn.
-使用较小的画布,2000x2000分辨率非常大. 1920x1080是高清
- Use a smaller canvas, 2000x2000 is pretty large resolution. 1920x1080 is HD
-改进您的显卡以处理大分辨率
- Improve your graphics card to handle the large resolution
请检查以下内容:
祝你好运!
这篇关于如果放置在Viewport2DVisual3D上的画布较大,则会变得模糊的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!