问题
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