Game Development Community

CustomMaterial affecting shape orientation??

by NTN Buzztime Site License (#0001 · in Torque Game Engine Advanced · 06/12/2007 (12:55 pm) · 2 replies

First, I should mention that I'm working in the PC build of the TSE-360 code branch...

I have a simple DTS shape loaded and when I override the material with a standard material mapping:

new Material(MenuSlab)
{
mapTo = checker;


baseTex[0] = "~/data/shapes/main_menu/checker";
specular[0] = "1.0 1.0 1.0 1.0";
specularPower[0] = 24.0;
};


Everything works fine. BUT when I change over to a CustomMaterial (so I can use shaders eventually):

new CustomMaterial(MenuSlab)
{
mapTo = checker;

texture[0] = "~/data/shapes/main_menu/checker";
specular[0] = "1.0 1.0 1.0 1.0";
specularPower[0] = 24.0;
};

The object renders properly except it appears the Z/Y axis has been exchanged. In other words, it is facing up instead of the camera. I know the world matrix of the object is fine because it has mount nodes and the mounted objects are still oriented properly. Any ideas what is causing this?

#1
06/12/2007 (1:08 pm)
Hrm... when I specify a test shader datablock, it orients properly. I would assume there's a procedural or generic shader that runs if I don't specify one. Oh well, guess I better start writing some shaders!
#2
06/12/2007 (3:09 pm)
This is a guess, but CustomMaterials by definition are looking for a shaderdata, and you might have found a slight user robustness bug if one is not defined in the CustomMaterial.

The main reason is that TGE-A doesn't support fixed function at all, and a "normal" material is going to generate a shader for you internally, where as a CustomMaterial by definition is looking for a user supplied shader.

It should probably warn in this case, or provide a default that doesn't do anything.