www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: guiloic on March 11, 2006, 08:41:59 pm

Title: Textured 3DS model
Post by: guiloic on March 11, 2006, 08:41:59 pm
I'm trying to use a textured 3DS model but as result I've a dark stain...

here is my code :

Code: [Select]

Object3D[] objs = Loader.load3DS("models" + File.separatorChar + "balloon.3ds", 1);
this.model = objs[0];
for(int i=1; i<objs.length; i++)
this.model.addChild(objs[i]);
model.build();


I have the same result in software and in hardware mode.
Title: Textured 3DS model
Post by: EgonOlsen on March 11, 2006, 11:17:11 pm
I'm not sure if adding the parts of the 3ds as childs of the first part really is what you want...but it's reasonable for some cases, so...
In any case, you have to add an Object3D to the world and if you don't merge the parts to one (like the fps-example does it for example), you have to add them all to the world (and build them all). In your code, i can't see you adding them to the world and you are obviously only calling build on the first part.
Title: Textured 3DS model
Post by: Melssj5 on March 12, 2006, 01:26:10 am
Yes, what happens is that the render acts over the defined World, in other worlds, you render what the Camera see of the World, if you dont add the objects to the World, then you obviously wont see anything.

Be sure to add some lights too and be sure that your camera is pointing to the object, if not you wont see anything because the camera wont look at the object.
Title: Textured 3DS model
Post by: guiloic on March 12, 2006, 11:56:25 am
Thank you very much :)

Code: [Select]
Object3D objs[] = Loader.load3DS("models" + File.separatorChar
+ "balloon.3ds", 1.5f);
this.model = objs[0];

for(int i=1; i<objs.length; i++) {
this.model = Object3D.mergeObjects(this.model, objs[i]);
objs[i].build();
}

this.model.rotateX(-3.14f / 2.0f);
this.model.build();
Title: Textured 3DS model
Post by: EgonOlsen on March 12, 2006, 12:20:50 pm
This call: objs.build(); isn't required, because you are "building" the merged model anyway. You can leave it out to gain some performance.