3ds Model'ss UVs Load Wrong

Anonymous 9 years ago 0
This discussion was imported from CodePlex

ZeroSigma wrote at 2013-03-13 18:42:

Hi, I'm trying to load a 3ds model that I exported out of Blender and everything goes fine but the texture looks wrong. Each face should have its own colour.

This is the code I use to load the model and assign the texture:
 _currentModel = ModelImporter.Load("../../Models/planetCube.3ds");
 Model3DGroup modelGroup = (Model3DGroup)_currentModel;

GeometryModel3D model = (GeometryModel3D)modelGroup.Children[0];

var texture = new ImageBrush();
texture.ImageSource = new BitmapImage(new Uri(@"../../Textures/uvTest2.png", UriKind.Relative));
            model.Material = new DiffuseMaterial(texture);
Here are the files:

ZeroSigma wrote at 2013-03-16 08:22:

Solved it thanks to this article on stackoverflow: Why does TextureCoordinates work as expected for a Viewport2DVisual3D, but not for a GeometryModel3D?

Just set ViewportUnits on the ImageBrush to Absolute! :)

objo wrote at 2013-03-17 21:50:

I had a quick look at your model files - it seems like there is no texture defined in the .3ds file?
The StudioReader class already sets the ViewportUnits to Absolute, so I don't think any change is necessary in this library.