Helix Sharp DX中的灯无法正常工作 [英] Lights not working properly in Helix Sharp DX

查看:164
本文介绍了Helix Sharp DX中的灯无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试使用Helix Toolkit( https://github构建obj文件查看器. com/helix-toolkit/helix-toolkit ).到目前为止,我已经能够加载目标文件并将其内容呈现给Helix Viewport3DX.使用某些obj文件,模型看起来不错,但对于其他文件,则存在一些闪电问题,并且背面始终为黑色.我不确定我在做什么错.这是因为SharpDX不支持背面材料吗?请帮忙.

I am trying to build an obj file viewer using Helix Toolkit (https://github.com/helix-toolkit/helix-toolkit) with SharpDX. So far I am able to load an object file and render it's contents to Helix Viewport3DX. Model looks good with some obj files but for others there are some lightning problem and back surfaces are always black. I am not sure what am I doing wrong. Is this light problem due to the fact that SharpDX does not support back materials?? Please help.

使用Helix Sharp DX的问题:

Problem using Helix Sharp DX:

Adob​​e DC Reader中的原始模型如下所示:

Original Model in Adobe DC Reader looks like this:

Viewport3DX设置为:

Viewport3DX settings are:

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

推荐答案

我不确定您对后备材料"的含义.

I'm not sure what u mean with "back materials".

SharpDX支持您想要的功能,因为它只是DirectX的包装,问题可能与helix有关,但我也不是很清楚,因为helix是基于SharpDX的框架,只是使用SharpDX建立我自己的框架.

SharpDX supports what ever u want it to as its just a wrapper around DirectX, the issue could have something to do with helix but again I don't really know because helix is a framework that is based on sharpDX and I'm just using sharpDX to build my own framework.

您永远不会绘制网格的背面,因为您无论如何都看不到它,那么为什么还要发送图形呢?

You never draw the back side of a mesh because u cant see it anyway so why bother sending drawing it?

看起来光似乎有某种衰减,但是因为它是没有方向性的定向光.

It almost looks like there is some sort of falloff on the light but because its a directional light that would be of no use.

有时候,在最大值时,我必须翻转法线,以使游戏中的内容正确绘制,或者在我用assimp导入网格时更改缠绕顺序.

Sometimes in max I have to flip the normal so things draw right in game or I change the winding order when I import the mesh with assimp.

这篇关于Helix Sharp DX中的灯无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆