如何利用反锯齿在WPF 3D [英] How to using anti-aliasing in wpf 3d

查看:187
本文介绍了如何利用反锯齿在WPF 3D的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

家伙! 我想在WPF来实现这一点,这里的链接: http://www.matthiasdittrich.com/

guys! I want to implement this in wpf, here's the link: http://www.matthiasdittrich.com/

所以,我应该把在viewport3d一些2D内容。我用Viewport2DVisual3D作为容器2D元素。但是,我遇到了严重走样,我添加了RenderOptions.EdgeMode =别名,但它不能正常工作。

So I should put some 2d content in viewport3d. I used Viewport2DVisual3D as the container for 2d elements. But I encountered serious aliasing, I added the RenderOptions.EdgeMode="Aliased",but it does not work.

下面是我的XAML:

<Viewport3D RenderOptions.EdgeMode="Aliased">
        <Viewport3D.Camera>
            <PerspectiveCamera Position="0, -2, 6" LookDirection="0, 2, -6"/>
        </Viewport3D.Camera>
        <Viewport2DVisual3D RenderOptions.EdgeMode="Aliased">
            <Grid Width="400" Height="400">
            <s:SurfaceScrollViewer>
                <ItemsControl>
                    <Label Background="LightGray"
                                Content="hahaha"/>
                    <Label Background="DarkGray"
                                Content="hahaha"/>
                    <Label Background="LightGray"
                                Content="hahaha"/>
                    <Label Background="DarkGray"
                                Content="hahaha"/>
                    <Label Background="LightGray"
                                Content="hahaha"/>
                    <Label Background="DarkGray"
                                Content="hahaha"/>
                    <Label Background="LightGray"
                                Content="hahaha"/>
                    <Label Background="DarkGray"
                                Content="hahaha"/>
                    <Label Background="LightGray"
                                Content="hahaha"/>
                    <Label Background="DarkGray"
                                Content="hahaha"/>
                    <Label Background="LightGray"
                                Content="hahaha"/>
                    <Label Background="DarkGray"
                                Content="hahaha"/>
                </ItemsControl>
            </s:SurfaceScrollViewer>
            </Grid>
            <Viewport2DVisual3D.Material>
                <DiffuseMaterial Viewport2DVisual3D.IsVisualHostMaterial="True" Brush="White"/>
            </Viewport2DVisual3D.Material>
            <Viewport2DVisual3D.Geometry>
                <MeshGeometry3D Positions="-1,2,0 -1,-2,0 1,-2,0 1,2,0"
                        TextureCoordinates="0,0 0,1 1,1 1,0" TriangleIndices="0 1 2 0 2 3"/>
            </Viewport2DVisual3D.Geometry>
        </Viewport2DVisual3D>
        <ModelVisual3D>
            <ModelVisual3D.Content>
                <DirectionalLight Color="#FFFFFFFF" Direction="0,0,-1"/>
            </ModelVisual3D.Content>
        </ModelVisual3D>
    </Viewport3D>

任何人可以帮助我吗?在此先感谢!

Can anybody help me? Thanks in advance!

推荐答案

我假设RenderOptions.EdgeMode =别名是 ANTI -Alias​​ed对面所以也许你不应该接触,设置

I am assuming RenderOptions.EdgeMode="Aliased" is the opposite of ANTI-Aliased so maybe you shouldn't touch that setting.

这篇关于如何利用反锯齿在WPF 3D的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆