Texture Can't be seen after loading

Anonymous 10 years ago 0
This discussion was imported from CodePlex

charismatubagus wrote at 2013-01-23 15:31:


I have successfully displayed a 3ds file in my WPF scene. But, the material color is just black and no texture is applied on it. 


<h:FileModelVisual3D x:Name="model3D" >
                        <ScaleTransform3D ScaleY="5.0" ScaleX="3.0" ScaleZ="2.0"/>
                        <TranslateTransform3D OffsetX="0" OffsetY="3" OffsetZ="0"/>
How can I load the texture as well automatically? Thanks in a million.

objo wrote at 2013-01-23 20:21:

is the texture in .tga format? .tga is not supported. Change the images to .png, and the importer will replace .tga with .png in the file names when loading the textures...

charismatubagus wrote at 2013-01-25 07:53:

The texture format is jpg. So you're saying I just need to convert the image format into png?

objo wrote at 2013-02-04 15:15:

No, JPEG should be supported. Then I think the error is somewhere else. Can you debug the code? Check if the image is loaded correctly. Set a breakpoint on line 527 in StudioReader.cs

zoras wrote at 2013-06-02 21:29:

I say sorry if i'm replying to a post a little bit old, ma my issue is nearly similar to this one.

My problem:
I'm reading all the .3ds and .obj file in the execution folder and loading them in a list where i can choose the one i want and show it in an HelixViewPort3D. All this part goes really well, the problem is with the texture. I don't see them at all :(
the way i'm loading the models:
FileModelVisual3D MyModel = new FileModelVisual3D();
MyModel.Source = MODELS[i];   //where MODELS[i] is a string containing the path of a model (i.e. .../.../ship.3ds)
this.view1.Children.Add(MyModel);   //where view1 is my HelixViewPort3D
I also read in this forum that i can use the StudioReader. Well, i tried, but i cannot figure out on how convert the Model3D from the reader into something Visual that i can then add as a children to my viewport.
I also tried to use a ModelVisual3D in the .xaml file, like in this sample http://helixtoolkit.codeplex.com/discussions/354077, binding its content to MyModel, but it doesn't work for me, for two reasons: first of all it does not load the .obj file; second one, when it loads a .3ds, in the viewport i cannot see nothing :(

pls help! :(

i just want to show or attach the texture to my model! :)

thanks so much for the library!

objo wrote at 2013-06-08 07:24:

Do you have lights in your scene?
I recommend setting a breakpoint on line 527 in StudioReader.cs, then you can check if the texture is loaded correctly!