如何在Helix Toolkit中向3ds模型添加纹理

时间:2019-05-05 18:55:09

标签: c# wpf helix-3d-toolkit

如何为3ds模型添加纹理图像?
纹理看起来像这样:Texture

当前,我可以向其中添加漫反射材质,但是只有在将模型拆分为多个GeometryModel3D时才能使用。

var importer = new ModelImporter();
var model = importer.Load(@"C:\Users\ericr\Desktop\B_787_8.3ds"); // Load Model
DiffuseMaterial material = new DiffuseMaterial(new SolidColorBrush(Color.FromRgb(255, 100, 200)));

ModelVisual3D visual3D;

// convert to geometry model to be able to add materials
for (int i = 0;i <= model.Children.Count -1;i++)
{
      GeometryModel3D geomodel = model.Children[i] as GeometryModel3D;
      geomodel.Material = material;
      visual3D = new ModelVisual3D();
      visual3D.Content = geomodel;
      ShopViewPort.Children.Add(visual3D); // add to viewport
 }

0 个答案:

没有答案