Materials are universal.
by ejr · in Torque 3D Professional · 04/09/2014 (4:32 pm) · 10 replies
The problem. Whatever material that is last used in the material editor is applied to all imported meshes.
Some background. My pipeline is Zbrush OBJ to Softimage Collada to Torque. The meshes import fine, no problems, materials import fine, no problems, the only problem is binding or assigning a material to a mesh. If I assign a material to one mesh all meshes assume it. This doesn't happen when a level is open, but all meshes revert to the last used material when the level is re-opened. I also notice that when I select separate meshes with the material editor open that the material doesn't change with the selected mesh. In the shape editor the material listed is unchangeable. I have tried various naming conventions, folder locations, and folder export locations out of Softimage, but nothing seems to change the problem. I have been willing to accept this as a bonehead mistake which I would eventually figure out but when the same thing started occurring with decals, (no surprise since they are also handled through the material editor), where meshes assumed all the attributes of the last decal used including alpha settings and transparencies it sort of put me over the edge. Any help?
I will say that I have started using Torque after trying numerous game engines, my main reasons are first that the interface seems very intuitive, the second that it is easier to import models into this program than the others I have tried. This may seem to be a strange statement given the problem I am experiencing with the material editor but it is true. Getting things into many other game engines is a nightmare. Love the engine just need to figure out what I am doing wrong here.
Thanks much for any help. Eric
Some background. My pipeline is Zbrush OBJ to Softimage Collada to Torque. The meshes import fine, no problems, materials import fine, no problems, the only problem is binding or assigning a material to a mesh. If I assign a material to one mesh all meshes assume it. This doesn't happen when a level is open, but all meshes revert to the last used material when the level is re-opened. I also notice that when I select separate meshes with the material editor open that the material doesn't change with the selected mesh. In the shape editor the material listed is unchangeable. I have tried various naming conventions, folder locations, and folder export locations out of Softimage, but nothing seems to change the problem. I have been willing to accept this as a bonehead mistake which I would eventually figure out but when the same thing started occurring with decals, (no surprise since they are also handled through the material editor), where meshes assumed all the attributes of the last decal used including alpha settings and transparencies it sort of put me over the edge. Any help?
I will say that I have started using Torque after trying numerous game engines, my main reasons are first that the interface seems very intuitive, the second that it is easier to import models into this program than the others I have tried. This may seem to be a strange statement given the problem I am experiencing with the material editor but it is true. Getting things into many other game engines is a nightmare. Love the engine just need to figure out what I am doing wrong here.
Thanks much for any help. Eric
#2
04/09/2014 (6:08 pm)
Yes, you need to make sure to name every material individually. Torque has some functions for switching materials and stuff in the engine, but it does not work properly, so make it right before you get it into the engine.
#3
Yes, I had browsed forum threads before and had seen that naming could be an issue so I have been quite careful about that. All textures have unique names coming out of Zbrush carrying through to Torque. I have tried different naming conventions when importing the materials into Torque, keeping them the same as the original .png files, changing them slightly, and even uninstalled and re-installed Torque in between different attempts to make sure there wasn't some corruption associated with the naming hiding somewhere in the system. I have reviewed names in the materials cs. Some of the current .png files coming out of Softimage include 'ChairOne' and 'BasicChest' so they are certainly unique. But the problem has been persistent.
04/09/2014 (7:44 pm)
Thanks for your replies.Yes, I had browsed forum threads before and had seen that naming could be an issue so I have been quite careful about that. All textures have unique names coming out of Zbrush carrying through to Torque. I have tried different naming conventions when importing the materials into Torque, keeping them the same as the original .png files, changing them slightly, and even uninstalled and re-installed Torque in between different attempts to make sure there wasn't some corruption associated with the naming hiding somewhere in the system. I have reviewed names in the materials cs. Some of the current .png files coming out of Softimage include 'ChairOne' and 'BasicChest' so they are certainly unique. But the problem has been persistent.
#4
04/10/2014 (3:41 am)
No idea, maybe screenshots would help. But I can say, that the naming of the image files is no issue, you can safely change them from the material editor in Torque.
#5
04/10/2014 (7:34 pm)
I believe I can see where the problem lies. In the material editor there are two naming fields at the top of the editor the first follows the .dae mesh name and features a drop down menu, the second lists the material name and features the globe icon for browsing materials. If I open a stock mesh that comes with T3D the material assigned to that mesh will be named in the .dae field. In the materials I am importing and attempting to apply that field remains 'DefaultMat'. So it would appear that I am dealing with a mapping issue. Saving my changes in the materials editor does not seem to affect this and what is apparently happening is that whatever material I select last becomes recognized as the DefaultMat which is then applied to all meshes. Since saving changes in the material editor does not seem to affect this I have attempted to make the change in the materials cs which has also been unsuccessful. Since I have been careful about my naming conventions perhaps this is simply some sort of bug associated with Softimage...
#6
04/10/2014 (8:11 pm)
Perhaps deleting the materials.cs files in each of those models' folders and re-importing them? The material editor has long had some odd quirks when saving materials....
#7
04/11/2014 (3:25 am)
This is exactly the field that causes the trouble, if you do not touch it, it will not produce issues I think. So better delete the material.cs of your model or the material in the file where it is stored and import the model again and leave the default material and only change settings and textures of the material, not rename or try to switch it.
#8
It is much tricky to get that working well. Most time i use milkshape as last tool, before i make a DTS model. I just like the DTS exporter there, and most time it works well, when you used milkshape to make the DTS model.
But milkshape don't use the material you made in milkshape. it use the diffuse texture name.
When i then import the dts to T3D it generate automatically an material based on the diffuse texture you had connected in milkshape to the mesh.
But now the problem about sharing of the diffuse texture. We now know, that the import in the engine generate a default material based on the diffuse texture, but we want share this texture with other materials and use different normal maps for high poly details.
So when i use the same diffuse texture for several models, the engine get a problem about we have a shared diffuse for different models, but we need for each model a own material.
Now, to fix that I take the shared diffuse texture, and copy it and new name it, so i can import the shared diffuse texture with different name, and then the engine create for each diffuse texture an own material.
After i got different materials, i just change the shared diffuse texture at all the materials i got before.
Not sure this can help you, but when you try to make shared texture for different models with have each a own material, this could help.
04/12/2014 (5:05 am)
The biggest problem is almost, when you need to use shared textures. Let's say you have shared diffuse texture, but you have different normal maps. So you need to make a new material for every model, but you share the diffuse texture. It is much tricky to get that working well. Most time i use milkshape as last tool, before i make a DTS model. I just like the DTS exporter there, and most time it works well, when you used milkshape to make the DTS model.
But milkshape don't use the material you made in milkshape. it use the diffuse texture name.
When i then import the dts to T3D it generate automatically an material based on the diffuse texture you had connected in milkshape to the mesh.
But now the problem about sharing of the diffuse texture. We now know, that the import in the engine generate a default material based on the diffuse texture, but we want share this texture with other materials and use different normal maps for high poly details.
So when i use the same diffuse texture for several models, the engine get a problem about we have a shared diffuse for different models, but we need for each model a own material.
Now, to fix that I take the shared diffuse texture, and copy it and new name it, so i can import the shared diffuse texture with different name, and then the engine create for each diffuse texture an own material.
After i got different materials, i just change the shared diffuse texture at all the materials i got before.
Not sure this can help you, but when you try to make shared texture for different models with have each a own material, this could help.
#9
The material editor inside Torque is a nice feature, but it is also unfinished, so you get problems with it here and there.
04/12/2014 (8:57 am)
I create my non-model-specific materials all by hand, I create a new materials.cs file and if I have new textures I write them into there and add diffuse,normal,specular maps, now in your modeling program, you just need to name the material the same you did in your materials.cs and torque will automatically apply existing materials to your meshes.The material editor inside Torque is a nice feature, but it is also unfinished, so you get problems with it here and there.
#10
Zbrush assigns materials and names them on its own after the mesh name. But I thought that the problem might be that Softimage was renaming the textures, which indeed it was. I didn't realize this since it only renames them internally but doesn't rename the external maps created by Zbrush. So I renamed them in Softimage.
Importing the meshes into T3D still did not import the materials/textures although the .dae file name field in the material editor mentioned above did show the name of the desired material.
I looked in the materials cs and saw that the path for the diffuse map was incorrect having included my computers name in the path instead of just the hard drive directory. I fixed that. (This may not have been necessary).
Upon looking at the mesh again it still did not show the material applied, in the materials editor I could find the material but it was blank and did not have the .bmp map assigned to it, I did that through the edit button in the materials editor.
And hurray the material is applied, and remains assigned to the mesh even if I follow the same steps with another imported mesh which has a different material applied to it.
Undoubtedly the most important part of this was correcting the naming in Softimage as that what was generating the DefaultMat name that was showing up in the .dae naming field in the material editor even though the Zbrush .bmp name was showing up in the browsing name field.
I must admit I was getting a bit discouraged, but I find these extra couple steps to insure a successful import to be quite minor.
Thanks for your help all who took part in this thread. Eric.
04/12/2014 (10:44 am)
O.k. so I resolved how to deal with this, thanks to input. Zbrush assigns materials and names them on its own after the mesh name. But I thought that the problem might be that Softimage was renaming the textures, which indeed it was. I didn't realize this since it only renames them internally but doesn't rename the external maps created by Zbrush. So I renamed them in Softimage.
Importing the meshes into T3D still did not import the materials/textures although the .dae file name field in the material editor mentioned above did show the name of the desired material.
I looked in the materials cs and saw that the path for the diffuse map was incorrect having included my computers name in the path instead of just the hard drive directory. I fixed that. (This may not have been necessary).
Upon looking at the mesh again it still did not show the material applied, in the materials editor I could find the material but it was blank and did not have the .bmp map assigned to it, I did that through the edit button in the materials editor.
And hurray the material is applied, and remains assigned to the mesh even if I follow the same steps with another imported mesh which has a different material applied to it.
Undoubtedly the most important part of this was correcting the naming in Softimage as that what was generating the DefaultMat name that was showing up in the .dae naming field in the material editor even though the Zbrush .bmp name was showing up in the browsing name field.
I must admit I was getting a bit discouraged, but I find these extra couple steps to insure a successful import to be quite minor.
Thanks for your help all who took part in this thread. Eric.
Associate Ron Kapaun
3tdstudios.com