I have a model of a human head with hair...don't worry about the bleeding, I'm only trying to get a rudimentary program going for altering meshes and things.
It's an .OBJ model and I am loading it using the Helix 3D toolkit. I tried various ways of getting the material used for the hair (once the model is loaded). The hair is a child mesh and is child 0. I am calling the imported model 'start' and it is loaded like this :
ObjReader CurrentHelixObjReader = new ObjReader();
start = CurrentHelixObjReader.Read("C:/Users/Roger/Desktop/head/base_med_.obj");
The model can be loaded successfully but things break when I attempt this :
Material matty = (MaterialGroup)((GeometryModel3D)start.Children[0]).Material;
What I am trying to do is get the material from the original model. Is this the correct way to create a new material from an existing one ?
Once I have the material I would want to use it at a later stage.
I would welcome any advice and thank you for taking a look.
EDIT: Error Message is :
"An unhandled exception of type 'System.Windows.Markup.XamlParseException' occurred in PresentationFramework.dll Additional information: 'The invocation of the constructor on type 'HelixTrial.MainWindow' that matches the specified binding constraints threw an exception.' Line number '4' and line position '9'. If there is a handler for this exception, the program may be safely continued."
OK I think I found the solution, I simplified my code to just this and it's working now.
Changed to :