Problems getting textures to work on my model

Hello all,



I'm working on my game but I can't get my texture to work right. It works right in 3dmax. but after I export from 3dmax to a 3ds file, the texture dissapears.



I tried the following code:


URL modelUrl = this.getClass().getClassLoader().getResource(modellocation);
converter.setProperty("mtllib", modelUrl);
ByteArrayOutputStream bo = new ByteArrayOutputStream();
URL textureUrl = this.getClass().getClassLoader().getResource(texturelocation);
TextureKey.setOverridingLocation(textureUrl);
converter.convert(modelUrl.openStream(), bo);
modelNode = (Node) BinaryImporter.getInstance().load(new ByteArrayInputStream(bo.toByteArray()));



Where the modellocation points to the model file and the texture location points to the directory where the texture file is located.

The model loads correctly, by no texture is displayed.

Any ideas?

Maybe this is unrelated, but someone else had problems with textures not loading correctly because the exporter/importer used some absolute path to the texture file. http://www.jmonkeyengine.com/jmeforum/index.php?topic=5146.0



If you have a hex editor, maybe you can see if this is the problem.

I read that one as well already. Thing is, when I just do an export from 3dmax, and then do an import in 3dmax of the same file, the textures are also gone. So I think I'm doing something wrong with the export, but I can't figure out what it is.

I know you can export 3ds files from 3D Max in two variations, one preserves 'Texture…' something (cant quite remember what it is though).

Anyone have any ideas where I can find my problem?

My idea is that I'm doing something wrong with exporting the model from 3dmax. I got a max model from a friend and now I have to export it in such a way that jme can render it. I got the 3ds model and it render great, but I can't figure out how to export the textures in such a way that they render as well.

Hi, you try this?



converter.setProperty("texurl", textureUrl);



It work fine for me unique problem is textures not smoothed… 

Nope, no effect in my case.



if you could send me your model and texture, I could try it with that, see if the problem is in my code or in my model.



The address is ractoc[at]ractoc[dot]com

Sent, good luck!

Ok, the texture on your model IS working, so the problem isn't in my code. (also get the problems with the texture not being smooth though).



So I take it my problem lies in the way I export the model and texture from 3dmax. Can anyone give me some pointers on how to make that work right?

Same problem with smooth… that keep my unresolved problem for now.



I now start to export in collada, that export Camera also… good is make a model with a Cam…

Try to think about a fps game with various race (like UT) where the models have different cam settings according to race type :stuck_out_tongue: exported direcly from Max… 

Ok, but how do I export to colada from Max? do I need some sort of max plugin for that?

You can get it after a free registration on: http://www.feelingsoftware.com/

Hhmmzz… I think I found part of the problem. My textures are an external file from my max model file. Could this be the reason the textures dissapear when I export my model?

I would say yes… maybe try to check the binary file to see if there is any reference to the texture files.

Well, I ran my 3ds through a hex editor, and I couldn't find any references to the texture file. None.

What about the model Achilleterzo sent you? Can you check it too?

already did, it works, and it has the name of the texture file in the 3ds file.

Oh well! at least now we know for sure why it doesn't show the textures…  :expressionless:

Yeah, only question now is, why doesn't my 3ds file have a reference to my texture? In 3dmax the texture shows no prob. Although it doesn't show when I press the render button. Anyone have any ideas about this?

Is it a math generated texture/material?  Like a wood pattern, etc.