Search code examples
wpfsharpdxhelix-3d-toolkit

Is it possible to automatically render the texture on the back of a mesh as with WPF 3D Material.BackMaterial property?


With HelixToolkit.SharpDX.WPF when setting the material on a MeshGeometryModel3D, it does not seem possible to set a 'BackMaterial' on such that both the front and back of the mesh use the same material, in the particular usage case of applying textures with a DiffuseMap and DiffuseColor.

In WPF 3D this is possible by setting the BackMaterial property. Is there something similar I can access but I am not aware of?

Ideally I don't want to have to duplicate the model and reverse the winding order of the triangles to achieve this.

enter image description here


Solution

  • You can use following sample code:

            <hx:MeshGeometryModel3D
                CullMode="Front"
                FillMode="{Binding FillMode}"
                Geometry="{Binding Model}"
                InvertNormal="True"
                Material="{Binding InnerModelMaterial}" />
            <hx:MeshGeometryModel3D
                CullMode="Back"
                FillMode="{Binding FillMode}"
                Geometry="{Binding Model}"
                Material="{Binding ModelMaterial}" />