Skip to main content

How to Load model with its textures

3 replies [Last post]
Joined: 2010-07-26

Hey all,

This is my first post in this forum so i will take a moment and greet you all and letting you know that i found some really helpfull topics here, keep up the good work ;)

So i am new to Java3d.
I am working on my thesis, developing a Board 3D Game.
What i want to do is simple in words.
I would like to be able to download some .3ds .obj or whatever models, and load them into my Game. This is easily doable using a Loader such as Loader3ds.
But what about textures?
All i am getting is a white mess....

What i am doing is this:

Scene s = null;
ModelLoader modelLoader = new ModelLoader();

try {
s = modelLoader.load(model);
catch ( Exception e) {

BranchGroup sceneGroup = s.getSceneGroup();
TransformGroup objBoundsTG = new TransformGroup();
objBoundsTG.addChild( sceneGroup );

This will display the model but without any textures.
What do i have to do to make this work?
It sounds really convenient to be able to load models in that way.

Any help would be appreciated.
Thank you in advance!

Reply viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Joined: 2010-08-17

Ever minded switching to the next page of the forum? The answer has been posted, loader's basics are the same for every particular loader.
In your case, it's .setBaseURL(), I guess.

Good luck.

Joined: 2003-07-17

Sir, please check the following :

* make sure the texture image files are available in the same folder or in a subfolder pointed by your 3d model file
* check if texture dimensions are power of two (256,512,1024,etc). Several DCC programs uses textures of any size, but this is not possible with most video cards and JAVA3D, D3D, OpenGL etc. If so, simply resize it to closest power of two size.
* Check if you textures are in valid format. JPG, PNG, GIF are all good.

Joined: 2010-07-26

Really? Noone?

Noone had never the need to load a model with its textures for his scene?
Well anyway. If someone does trying to figure this out except from me then this is some food for thought :

mnstarfire loader promises to load textures but i can't get it to work.
Maybe you need to setCapability() for enabling something?

Please if you know something about this do post your solution.