Object materials

Started by Mohawk20, January 30, 2007, 11:27:01 AM

Previous topic - Next topic

Mohawk20

Can anybody give me a hint?
I have made a structure in 3Dstudio Max, and I want to load it into TG2, with the materials it had assigned in 3DsM. I saved the mtl file with the export to obj, but I don't have a single clue how to use in TG2.

When I load the obj file (which I saved with a mtl file) I assume it loads the mtl with the same name automaticly, but when I check the internal nodes there is just the one multi shader, not the extra nodes per material.
I know I missed atleast one step, but I need to know which step. A step by step 'how to' would be very nice.
Howgh!

dhavalmistry

currently TG2 is having problems with OBJ's it crashed while rendering but LWO's work fine and I havent tried mtl but jpg as texture seems to work....
"His blood-terragen level is 99.99%...he is definitely drunk on Terragen!"

§ardine

#2
It seems that several people have had the same problem...  :(
Here is a temporary solution to manually set up the textures, that usually seems to work for me:

Note: one thing you will need to know before getting started is how many texture combinations your object has. Lets say you have 3 images that are used: a bark texture, a leaf texture and an alpha image for the leaf, this will give you 2 texture combinations (1)bark & (2)leaf with an alpha.

In in the internal nodes I set up a default shader for each of my texture combinations, connected with a Multi Shader:

[attach=#1]

in the properties of each default shader I input the texture image into the "Color>Color image" box. Any alpha images for this texture are placed in the "Opacity>Opacity image" box. Sometimes the texture image itself will contain its own alpha channel, in this case input* the texture image into the "Opacity image" box and check the "Use alpha channel" box.

[attach=#2]

Once you get everything set up I recommend that you save the object node as a TGO. The shader list for the model is saved inside the TGO format keeping you from having to set everything up again. You may find also that when you render an image of the object that the bark texture is on the leaves and the trunk has a leaf pattern on it... etc. To fix this simply go back to the internal nodes and change the order of the default shaders on the Multi shader.

I'm sure this won't fix every problem (I've run into a few objects that have required more work than this) but perhaps it will give you a start towards getting your models working. Also, this is hopefully a temporary solution until adding objects is improved in future releases.

*-To my understanding, this is bug that TG2TP does not properly read alphas from the color image so this is only necessary for now. (hopefully)

-also there are a few texture formats to avoid at the moment, including PNG and TGA. These formats will cause overly bright spots on your model and I believe other rendering issues as well. I have found that properly formatted TIF files will work great, and these can include an alpha channel.

anyway... hope I haven't rambled too much and confused everyone  :P
-§ardine

[Edit] just thought this would be good to remember  ;):
Quote from: Oshyan on January 29, 2007, 12:37:17 AM
...
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

Mohawk20

Good idea, just one problem... how do I retrieve the textures from the .mtl file?

(And does anyone know an easyer solution perhaps?)
Howgh!

§ardine

#4
The textures will be separate from your mtl file.
All the mtl file does is specify in plain text format what images, colors, etc to use with the object.
If you open up a mtl file in notepad you will see something like this:

# Blender3D MTL File: bamboo.blend
# Material Count: 2
newmtl bark
Ns 0
Ka 0.000000 0.000000 0.000000
Kd 0.8 0.8 0.8
Ks 0.8 0.8 0.8
d 1
illum 2
map_Kd phyllostachys_bark.jpg


newmtl leaf
Ns 0
Ka 0.000000 0.000000 0.000000
Kd 0.8 0.8 0.8
Ks 0.8 0.8 0.8
d 1
illum 2
map_Kd phyllostachys_leaf.tif


[Edit] as I read your first post again :D this may be one of the reasons you are having problems. Be sure you keep the images for your textures in the same directory as the model and MTL file. I've also been assuming that you are using actual images for your textures in your modeler and not just colors?

Mohawk20

I'm currently only using the standard materials, the ones the came with the program...

I'll go look for those image files!


Thanks a bunch!
Howgh!

hyper1

Mohawk20,

I'm a little concerned that you are talking about procedural textures, not image maps.  If you are you do have a problem.  Procedural textures are achieved mathmatically and are not generally transferable to another program.  On the other hand image maps are always interchangable between programs.

Quote from: Mohawk20 on January 30, 2007, 11:27:01 AM
Can anybody give me a hint?
I have made a structure in 3Dstudio Max, and I want to load it into TG2, with the materials it had assigned in 3DsM. I saved the mtl file with the export to obj, but I don't have a single clue how to use in TG2.

When I load the obj file (which I saved with a mtl file) I assume it loads the mtl with the same name automaticly, but when I check the internal nodes there is just the one multi shader, not the extra nodes per material.
I know I missed atleast one step, but I need to know which step. A step by step 'how to' would be very nice.


Mohawk20

Well, for glass I'll just use a reflective shader...

For the other textures I've found the images.

One last problem: I fear the image shader plugged into the 1st multishader imputnode, is being used for the entire object. Any ideas? Perhaps I exported the object wrong?
Howgh!

§ardine

Quote from: Mohawk20 on February 01, 2007, 04:47:03 PM
Well, for glass I'll just use a reflective shader...

For the other textures I've found the images.

One last problem: I fear the image shader plugged into the 1st multishader imputnode, is being used for the entire object. Any ideas? Perhaps I exported the object wrong?

I would have to agree with hyper1, it does sound like you have used a "procedural texture" in your modeler. Which might explain why your first shader is covering the entire object.

As for reflections there is also a tab on the default shader called "Specular' which is used to create very simple light reflections. This can be use with a texture in the same shader to give it a glossy look.

Mohawk20

That specular shader is a nice tip...

However, to be able to use it, my object should be covered in 3 diferent materials. 1 procedural texture for the glass, and 2 textured ones.
But if I understand correctly, I should just make that procedural one a textured one, and then export again?

I can make my own procedural textures in TG2 with some powerfractals, and wouldn't even need those textures, because they are stone images. But what I do need is the 3 different parts in my object.
Howgh!

Mohawk20

Well, the newly exported object still has just one material, covering the whole object.

I've zipped all the files in the directory of this project, so a few old tgd's are in there as well, but if somebody could take a look at the 'Gnosis Test 03.tgd', that would make me a very happy man.
http://www.ashundar.com/datas/users/2428-gnosis.zip
Howgh!

hyper1

Mohawk20,
I'm a little vague on what your asking, because you didn't present the Tower as to how it was suppose to look.
I checked the shaders (see pictures) they were all present both in the .mtl file and the .obj file.  However, on the two files that were image files they were set as "Through camera".  This setting is only used if you want to use the camera as a projector (very useful in certain circumstances).  Most of the time you'll select "Object UV".  Its not always appearent if the object has UVs, but its always good to check.  Last, I checked the tower "glass?".  The way you had it set up it would have rendered opaic, so I tried setting it to 75% transparent and gave it a color.  It appears that the model didn't have any glass, because nothing rendered at any transparency setting.  I hope this helps in some way.

[attachthumb=#]
[attachthumb=#]
Quote from: Mohawk20 on February 03, 2007, 11:55:32 AM
Well, the newly exported object still has just one material, covering the whole object.

I've zipped all the files in the directory of this project, so a few old tgd's are in there as well, but if somebody could take a look at the 'Gnosis Test 03.tgd', that would make me a very happy man.
http://www.ashundar.com/datas/users/2428-gnosis.zip

Dark Fire

That picture is amazing...

Mohawk20

This is the object in 3DsMax:
http://www.ashundar.com/CPG/displayimage.php?pos=-3804

As you can see, it has windows in the room on the top, devided by the pillars.


I replaced the glass material with an image texture for export.

I had allready found out about the projection method, while working on the slums around the tower. Fixed that.

Hope this helps... I'd like to know if it's even possible to use multiple materials on a 3DsMax exported object, and if so, whith what settings?
Howgh!

Njen

It is possible to use multiple materials and maps. For my new scene I am working on, I am exporting trees from Arbaro in obj format, then importing them in Max and giving them some material properties, assigning different materials and maps to the leaves and trunk/branches. I then played around with the export settings until I got a setup that imported into TG2 with no problems. I don't have time now, but I will post the settings for a successful export from Max later.