Disable face culling in WPF

浪子不回头ぞ 提交于 2019-12-08 03:54:18

问题


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.


回答1:


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



来源:https://stackoverflow.com/questions/4417457/disable-face-culling-in-wpf

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!