开发者

Disable face culling in WPF

开发者 https://www.devze.com 2023-01-30 06:30 出处:网络
I\'m starting experimenting with WPF 3D rendering, and one of the first problems I\'m facing, is how to disable face culling.

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>
                    </ModelVis开发者_开发问答ual3D.Content>
                </ModelVisual3D>
            </Viewport3D>

Thanks very much for any suggestion you could give me.


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

0

精彩评论

暂无评论...
验证码 换一张
取 消