在 WPF 中禁用面部剔除

发布于 2024-10-06 20:15:12 字数 1055 浏览 0 评论 0原文

我开始尝试 WPF 3D 渲染,我面临的第一个问题是如何禁用面部剔除。 我知道如何在 DirectX 和 OpenGL 中执行此操作,但我找不到在 WPF 中执行此操作的方法。 这是我的 ViewPort 标记。该模型是在运行时生成的,它是 GeometryModel3D 内的 MeshGeometry3D

  <Viewport3D x:Name="viewport"  DockPanel.Dock="Right" Margin="0" >
                <Viewport3D.Camera>
                    <PerspectiveCamera x:Name="camera" FarPlaneDistance="50" LookDirection="0,0,-10"
     UpDirection="0,1,0" NearPlaneDistance="0" Position="0,0,5"
     FieldOfView="45" />
                </Viewport3D.Camera>

                <ModelVisual3D x:Name="model">
                    <ModelVisual3D.Content>
                        <Model3DGroup x:Name="group">
                            <AmbientLight Color="DarkGray" />
                            <DirectionalLight Color="White" Direction="-5,-5,-7" />
                        </Model3DGroup>
                    </ModelVisual3D.Content>
                </ModelVisual3D>
            </Viewport3D>

非常感谢您给我的任何建议。

I'm starting experimenting with WPF 3D rendering, and one of the first problems I'm facing, is how to disable face culling.
I know how to do that in DirectX and OpenGL, but I can't find a way to do that in WPF.
Here is my ViewPort markup. The model is generated at runtime, and it's a MeshGeometry3D inside a GeometryModel3D

  <Viewport3D x:Name="viewport"  DockPanel.Dock="Right" Margin="0" >
                <Viewport3D.Camera>
                    <PerspectiveCamera x:Name="camera" FarPlaneDistance="50" LookDirection="0,0,-10"
     UpDirection="0,1,0" NearPlaneDistance="0" Position="0,0,5"
     FieldOfView="45" />
                </Viewport3D.Camera>

                <ModelVisual3D x:Name="model">
                    <ModelVisual3D.Content>
                        <Model3DGroup x:Name="group">
                            <AmbientLight Color="DarkGray" />
                            <DirectionalLight Color="White" Direction="-5,-5,-7" />
                        </Model3DGroup>
                    </ModelVisual3D.Content>
                </ModelVisual3D>
            </Viewport3D>

Thanks very much for any suggestion you could give me.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

给不了的爱 2024-10-13 20:15:12

据我所知不能,但你可以给背面也提供一种材料。

            DiffuseMaterial material = new DiffuseMaterial(new SolidColorBrush(Colors.Blue));
            GeometryModel3D geometryModel = new GeometryModel3D(geometry, material);
            geometryModel.BackMaterial = material;

问候, 杰伦

as far as i know it cannot, but you can give the backside also a material.

            DiffuseMaterial material = new DiffuseMaterial(new SolidColorBrush(Colors.Blue));
            GeometryModel3D geometryModel = new GeometryModel3D(geometry, material);
            geometryModel.BackMaterial = material;

Regards, Jeroen

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文