mtl files

Started by mhaze, January 25, 2007, 12:22:42 PM

Previous topic - Next topic

mhaze

Hi all

I'm trying to load object files from Xfrog - all goes well until I look for the texture files. The mtl file does not seem to load with the object a shader is allocated but it is empty - do I have to manually load each texture image and alpha?

Mick

rcallicotte

I haven't worked with a straight xFrog file to any major degree, but I know with even Wavefront OBJ files I needed to rearrange the MTL and the Multishader to make it work right.
So this is Disney World.  Can we live here?

mhaze

I'm expecting to have to directly edit the multishader but it looks like I'm going to have to load in each image and alpha file by hand after analysing the MTL file. I had hope that at least the data would be read from the mtl file and loaded automatically.


rcallicotte

I haven't seen that it's all automated.  Something going on, but it appears to me to be out of order.
So this is Disney World.  Can we live here?

mhaze

OK
Could some post a file that works so that I can play?

Mick

rcallicotte

Mick,

I don't have access to anything right now, but maybe this weekend I'll find time to put something together for you on this site - http://forums.planetside.co.uk/index.php?board=14.0

I need to be careful, since I won't give any objects that I had to pay for, due to copyright limits.
So this is Disney World.  Can we live here?

§ardine

Just thought that I would throw in my two cents here. :P

It seems to me that if the mtl file is set up right everything should load right. -I haven't fully tested this yet
However, if you have to manually set up the textures like you have mentioned, be sure to export the model to .tgo and you won't need to do it over using the new file.

note: this will also work with objs that don't have a mtl file. if you have the original textures just manually add a default shader to the multi shader of the object. Do this for each texture you have, adding the texture as the color image or alpha where appropriate. If you are able (obj are not very stable in TG2tp) be sure to do a render to make sure you got the textures into the right shader slot. other wise export to tgo and then render to see if the tex. are right.

This is a very basic explanation and I'm sure I confused a few people there but perhaps it might help somebody  ;D

mhaze

Thanks calico any of the free xfrog files will do

Thaks all for all the tips but it seems that the mtl file only contains colour definitions so maybe I'm using the wrong xfrog models! I'll try again tomorrow

Mick

Oshyan

There are currently problems with certain OBJ files in particular, notably the free XFrog models that are available. We're improving the OBJ loading and rendering behavior for an upcoming patch.

In general if the .mtl file is setup correctly it should indeed load properly and shouldn't require manual texture loading. It may be that pathing issues are getting in the way though. The easiest approach currently is to keep all objects and textures in the folder that your .tgd is saved in. If that is already the case then you may simply need to edit the paths in the .mtl to be local rather than absolute.

- Oshyan

mhaze

The problem turned out to be the paths.  So thanks everyone for your help.

Aenea

So far so good...

How do I LOAD a mtl-file?
How can I correct the data there?

Sorry, just don´t have a clue at the moment.....


Oshyan

.mtl files are loaded automatically in TG2 if they are associated with a given object. This association happens on export to the OBJ format from an application which supports writing texture information to an .mtl.

To edit a .mtl manually use a general text editor such as Notepad (in Windows), go to Open a file, select "All Files" from the format drop-down, then navigate to the location of your .mtl and open it. Be sure to save under "All Files" when you're done editing rather than ".txt", or rename to .mtl after you save if it changes it to .txt.

- Oshyan

Aenea

thanks a bunch Oshyan!!!!!!!!!!!!!!!!!!!!

I´ll try to do that as soon as I´m home....hopefully I can solve my problems with the tree obj in terragen.

I´m very close to get a wonderful tree from the old xfrog material. Like suggested in this forum I edited it with 3dwings so I was able to import it into terragen, but what annoys me still, is that the leaves and the trunk doesn´t look much realistic. Think there are still some mistakes in my multishader options as well as in the right picture association in the color tab and the opacity tab...will play around a bit with it.....
Maybe the mtl-file can solve some of my problems....

Thanks!

daphne

mr-miley

Quote from: Oshyan on February 14, 2007, 02:56:24 AM
.mtl files are loaded automatically in TG2 if they are associated with a given object. This association happens on export to the OBJ format from an application which supports writing texture information to an .mtl.

To edit a .mtl manually use a general text editor such as Notepad (in Windows), go to Open a file, select "All Files" from the format drop-down, then navigate to the location of your .mtl and open it. Be sure to save under "All Files" when you're done editing rather than ".txt", or rename to .mtl after you save if it changes it to .txt.

- Oshyan

Does anyone out there know if there is any set order to load textures in the multishader in relation to what order they are listed in the mtl file  ??? I have tried rearranging items orders in the multishader till I'm blue in the face and always end up with textures on the wrong part of the model.
I love the smell of caffine in the morning

helentr

Quote from: Aenea on February 14, 2007, 04:36:55 AM
thanks a bunch Oshyan!!!!!!!!!!!!!!!!!!!!

I´ll try to do that as soon as I´m home....hopefully I can solve my problems with the tree obj in terragen.

I´m very close to get a wonderful tree from the old xfrog material. Like suggested in this forum I edited it with 3dwings so I was able to import it into terragen, but what annoys me still, is that the leaves and the trunk doesn´t look much realistic. Think there are still some mistakes in my multishader options as well as in the right picture association in the color tab and the opacity tab...will play around a bit with it.....
Maybe the mtl-file can solve some of my problems....

Thanks!

daphne

Did you try my tutorial? http://forums.planetside.co.uk/index.php?topic=575.msg4880#msg4880
The old Xfrog plants did not have the right image for opacity and you need to make one.

Helen