我正在尝试使用 Helix Toolkit ( https://github.com/helix-toolkit/helix-toolkit ) 和 SharpDX 构建一个 obj 文件查看器。到目前为止,我能够加载一个目标文件并将其内容渲染到 Helix Viewport3DX。模型在某些 obj 文件中看起来不错,但对于其他文件,则存在一些闪电问题,并且背面总是黑色。我不确定我做错了什么。这是因为SharpDX不支持背面材料的事实吗?请帮忙。
Viewport3DX 设置为:
<Window.Resources>
<DataTemplate x:Key="Template1">
<hx:MyMeshGeometryModel3D Geometry="{Binding Geometry}" Transform="{Binding Transform}" Material="{Binding Material}"/>
</DataTemplate>
<hx:RenderTechniqueConverter x:Key="RenderTechniqueConverter"/>
</Window.Resources>
<hx:Viewport3DX x:Name="helixViewport" Camera="{Binding Camera}" CameraRotationMode="Trackball" RenderTechnique="{Binding RenderTechnique}" RenderTechniquesManager="{Binding RenderTechniquesManager}" EffectsManager="{Binding EffectsManager}" BackgroundColor="{Binding BackgroundColor}" UseDefaultGestures="False">
<hx:Viewport3DX.InputBindings>
<MouseBinding Gesture="LeftClick" Command="hx:ViewportCommands.Rotate"/>
<MouseBinding Gesture="MiddleClick" Command="hx:ViewportCommands.Zoom"/>
<MouseBinding Gesture="RightClick" Command="hx:ViewportCommands.Pan"/>
</hx:Viewport3DX.InputBindings>
<hx:AmbientLight3D Color="{Binding AmbientLightColor}"/>
<hx:DirectionalLight3D Color="{Binding DirectionalLightColor1}" Direction="-1,-1,-1"/>
<hx:DirectionalLight3D Color="{Binding DirectionalLightColor2}" Direction="1,-1,-0.1"/>
<hx:DirectionalLight3D Color="{Binding DirectionalLightColor3}" Direction="0.1,1,-1"/>
<hx:DirectionalLight3D Color="{Binding DirectionalLightColor4}" Direction="0.1,0.1,1"/>
<hx:ItemsModel3D x:Name="itemsModel3d" ItemTemplate="{StaticResource Template1}" ItemsSource="{Binding Items}"/>
</hx:Viewport3DX>