Feb 5, 2013 at 8:06 AM
Edited Feb 5, 2013 at 9:26 AM
Can anyone provide a working code for loading one\group of models from .obj .mtl and some .jpg files and rendering them on screen? I was trying to load models, but I cannot load or apply textures, and it gets messy.
I looked at example folder, but it only loads model with no texture.
I'm probably not applying them correctly, but there might be other errors.
I think there is a problem with materials; first I load the model
model = ModelImporter.Load("filename.obj");
material = (MaterialGroup)((GeometryModel3D)model.Children).Material;
then return that material:
this.theMaterial = (MaterialGroup)faceNeutral.getMaterial();
<LinearGradientBrush StartPoint="0,0.5" EndPoint="1,0.5">
<GradientStop Color="LightBlue" Offset="0" />
<GradientStop Color="LightBlue" Offset="1" />
but object still renders as LightBlue.
also number of times I got
//Unable to cast object of type 'System.Windows.Media.Media3D.MaterialGroup' to type 'System.Windows.Media.Media3D.DiffuseMaterial'.