Game Development Community

Confused Materials

by Judy L Tyrer · in Torque 3D Professional · 09/19/2009 (2:04 pm) · 2 replies

I have a simple box with a .jpg material added, exported into Collada. When I insert the item into the map, I get the wrong .jpg file attached to the box, but when I go to the material editor, the correct .jpg file is applied. TO make matters odder, the material applied in the world editor is the texture for the character which is not even in the correct location. There is only a diffuse map material, nothing else. Very simple. Very straightforward.

Here is the collada stanza:

<library_images>
    <image id="TownHouse1.jpg" name="TownHouse1_jpg">
      <init_from>./TownHouse1.jpg</init_from>
    </image>
  </library_images>
  <library_materials>
    <material id="_1_-_Default" name="_1_-_Default">
      <instance_effect url="#_1_-_Default-fx"/>
    </material>
  </library_materials>

And the materials.cs file from the same directory

singleton Material(TownHouse1__1___Default)
{
	diffuseMap[0] = "./TownHouse1";
	mapTo = "_1_-_Default";

	diffuseColor[0] = "1 1 1 1";
	specular[0] = "0.9 0.9 0.9 1";
	specularPower[0] = 0.415939;
	pixelSpecular[0] = false;
	emissive[0] = false;

	doubleSided = false;
	translucent = false;
	translucentBlendOp = "None";
};

Also, I note that the material editor states "this material has unsaved changes" each time you try to save it regardless of whether you've touched the material since the last time you hit save. At any rate, NOTHING I do in the material editor causes the material file to overwrite. It always shows the material from the player.




#1
09/19/2009 (2:45 pm)
diffuseMap[0] = "./TownHouse1";


I'm not sure "./" is valid syntax.

Try "core/......"
#2
09/19/2009 (9:27 pm)
"./" is perfectly valid. It turns out the problem was in the use of the material default-1 which is also defined for the character. When I changed to the default-2 material it rendered correctly. I'm not sure if this is Torque bug or not - the materials were in two different directories, but perhaps Torque can't tell the difference. Or maybe MAX can't. Hard to say, but after much gnashing of teeth, I got what I wanted.