www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: draga on December 01, 2009, 01:31:25 pm

Title: obj world
Post by: draga on December 01, 2009, 01:31:25 pm
Hello,

I've done a world in obj-format (+mtl file).
In the obj file there are many objects (trees,grasses).

If I now Load by the Loader Class, I get an Array of Object3D.
But how should I now load the textures ( with setTexture()  ) from an Object3D?
I don't know what texture should be assigned to the Object3D...



Title: Re: obj world
Post by: trisco on December 01, 2009, 01:53:27 pm
http://www.jpct.net/wiki/index.php/Loading_models (http://www.jpct.net/wiki/index.php/Loading_models)

this should help you, just make sure the names of the texture in the texturemanager correspond to the one in your obj file.
Title: Re: obj world
Post by: draga on December 09, 2009, 08:44:13 pm
thanks for your answer.

It seems that JPCT loads the textures automatically...It came always a message that the textures are already defined, after I run my "mtl texture loader"...
By the way...I only have white meshes, textures don't work at me...

Can you say what could be going wrong??
Title: Re: obj world
Post by: EgonOlsen on December 09, 2009, 10:11:12 pm
No, it doesn't load them. But if you are not loading them BEFORE you are loading the model, it creates white textures with the names from the file. Try to switch the order.
Title: Re: obj world
Post by: draga on December 10, 2009, 10:08:21 am
thanks it works ;)

Now I have still a problem:
The Billboards grasses/Trees are jpg files, and the transparent parts are black.
What should I do?
Title: Re: obj world
Post by: draga on December 10, 2009, 01:43:49 pm
ok, I fixed it by calling setTransparency(2)...
Now a house seems to move magically infront of trees, but in real it isnt so...
Have I to write a editor to make for example the house not calling setTransparency() ?
 
Title: Re: obj world
Post by: EgonOlsen on December 10, 2009, 08:21:02 pm
The loaders for 3ds and obj actually load transparency information from the file. If you objects are transparent in the editor, they should be in jPCT. If that's not an option, you need a way to identify if an object should be transparent or not. I'm usually using texture information for this, i.e. all objects that are using a texture "blahblah" are transparent...or use the objects' names instead.
Title: Re: obj world
Post by: draga on December 10, 2009, 08:29:49 pm
ok, thanks for your answer :)
Title: Re: obj world
Post by: draga on December 14, 2009, 03:21:11 pm
I have still a few questions:
About which methode(s) I get Information of a object's assigned texture (texture name for example)??
Title: Re: obj world
Post by: Wojtek on December 14, 2009, 07:02:13 pm
Hi,

The Object3D class has "PolygonManager getPolygonManager()" method, which you can use to get the texture id assigned to given polygon of your object (see "int getPolygonTexture(int polyID)" method of PolygonManager).

Next, you can use TextureManager.getInstance(). getTextureByID(textureId) to get the texture object that is associated to id returned by PolygonManager.

Hope that helps.

BTW. It is not possible to get the list of textures if polygon has more textures assigned.

Wojtek
Title: Re: obj world
Post by: draga on December 15, 2009, 10:45:55 am
ok, thanks. I'll try it. ;)