How to get Normal maps showing in the engine?
by Rob · in Torque Game Engine Advanced · 10/15/2005 (7:31 am) · 8 replies
Firstly I am very new to TSE, and right now I am just playing around trying to get a fountain I have created into TSE with a very simple normal map applied.
I use maya to model and what I have done so far is create a directory called Founty in example/demo/data/shapes and I have put the following line into a materials.cs file in this founty folder which contains the model (founty.dts) the main texture (testmap.png) and the normal map (testmap_bump.png)
(materials.cs)
//*****************************************************************************
// Custom Materials
//*****************************************************************************
// for writing to z buffer
new CustomMaterial( Blank )
{
shader = BlankShader;
version = 1.1;
};
new Material(testmap)
{
mapTo = founty;
baseTex[0] = "testmap";
bumpTex[1] = "testmap_bump";
pixelSpecular[0] = true;
specular[0] = "1.0 1.0 1.0 1.0";
specularPower[0] = 32.0;
};
//*****************************************************************************
// Environmental Materials
//*****************************************************************************
new CustomMaterial(TerrainMaterial)
{
shader = TerrShader;
version = 1.1;
};
new CustomMaterial(TerrainBlenderPS20Material)
{
shader = TerrBlender20Shader;
version = 2.0;
};
new CustomMaterial(TerrainBlenderPS11AMaterial)
{
shader = TerrBlender11AShader;
pixVersion = 1.1;
};
new CustomMaterial(TerrainBlenderPS11BMaterial)
{
shader = TerrBlender11BShader;
pixVersion = 1.1;
};
//*****************************************************************************
// Overview Panels
//*****************************************************************************
new Material(PanelSurface)
{
baseTex[0] = "~/data/shapes/panels/overview";
pixelSpecular[0] = false;
specular[0] = "1.0 1.0 1.0 1.0";
specularPower[0] = 4.0;
};
ignore the rest of the file it was a demo materials.cs file I think
Now when I load the model in the engine and save it in a scene I cannot see the bumps that the normal map should be creating, they show in maya when I export the model so it seems the normal map should work.
Do I need to apply a shader to the object?
Do I need to apply a light map to the object?
Do I need a alpha channel in any of my pngs?
I would be grateful for any help
Thanks
I use maya to model and what I have done so far is create a directory called Founty in example/demo/data/shapes and I have put the following line into a materials.cs file in this founty folder which contains the model (founty.dts) the main texture (testmap.png) and the normal map (testmap_bump.png)
(materials.cs)
//*****************************************************************************
// Custom Materials
//*****************************************************************************
// for writing to z buffer
new CustomMaterial( Blank )
{
shader = BlankShader;
version = 1.1;
};
new Material(testmap)
{
mapTo = founty;
baseTex[0] = "testmap";
bumpTex[1] = "testmap_bump";
pixelSpecular[0] = true;
specular[0] = "1.0 1.0 1.0 1.0";
specularPower[0] = 32.0;
};
//*****************************************************************************
// Environmental Materials
//*****************************************************************************
new CustomMaterial(TerrainMaterial)
{
shader = TerrShader;
version = 1.1;
};
new CustomMaterial(TerrainBlenderPS20Material)
{
shader = TerrBlender20Shader;
version = 2.0;
};
new CustomMaterial(TerrainBlenderPS11AMaterial)
{
shader = TerrBlender11AShader;
pixVersion = 1.1;
};
new CustomMaterial(TerrainBlenderPS11BMaterial)
{
shader = TerrBlender11BShader;
pixVersion = 1.1;
};
//*****************************************************************************
// Overview Panels
//*****************************************************************************
new Material(PanelSurface)
{
baseTex[0] = "~/data/shapes/panels/overview";
pixelSpecular[0] = false;
specular[0] = "1.0 1.0 1.0 1.0";
specularPower[0] = 4.0;
};
ignore the rest of the file it was a demo materials.cs file I think
Now when I load the model in the engine and save it in a scene I cannot see the bumps that the normal map should be creating, they show in maya when I export the model so it seems the normal map should work.
Do I need to apply a shader to the object?
Do I need to apply a light map to the object?
Do I need a alpha channel in any of my pngs?
I would be grateful for any help
Thanks
#2
Thanks for your reply, I will give it a try
10/16/2005 (1:53 pm)
Sorry its just that I just noticed I put it in the wrong forum, and wasn't sure if these forums are very well moderated or not so I didn't want to wait for it to get moved.Thanks for your reply, I will give it a try
#3
Seems that because i had textures mapped to the model when I exported it from Maya its written into the DTS and no amount of material.cs file editing will override the textures assigned to it?
I had a bump channel in Maya when I exported it, so I think perhaps that is blocking any materials being assigned to the bump channel of the DTS in the materials.cs file.
Does this sound like it could be the problem?
10/18/2005 (3:28 pm)
I just got some info on this problem but am unable to test it out now as Im at work but will do soon as I can.Seems that because i had textures mapped to the model when I exported it from Maya its written into the DTS and no amount of material.cs file editing will override the textures assigned to it?
I had a bump channel in Maya when I exported it, so I think perhaps that is blocking any materials being assigned to the bump channel of the DTS in the materials.cs file.
Does this sound like it could be the problem?
#5
Someone had a similar sort of probelm they said but I cant see that reply now?
Anyway to Mike:
Yeah I know it should be a 0, and I have changed that since posting this, as well as trying many other combinations that work in the SpaceOrc materials.cs and nothing worked.
10/18/2005 (8:00 pm)
Weird what happened to the other reply?Someone had a similar sort of probelm they said but I cant see that reply now?
Anyway to Mike:
Yeah I know it should be a 0, and I have changed that since posting this, as well as trying many other combinations that work in the SpaceOrc materials.cs and nothing worked.
#6
10/18/2005 (9:28 pm)
MapTo = founty; == Map to the texture name - extension, not the shape.
#7
10/18/2005 (10:00 pm)
From what I understand, Maya actually exports the whole texture name as the material name so if you are using founty.png on the model you would need maptTo = "founty.png"; rather than mapTo = "founty";
#8
10/19/2005 (7:14 am)
Thanks a bunch Matt you just solved my problem :D
Associate Joseph Euan
Make a blank materials.cs in the folder with the model and textures.... and only add the shader info to it that you need (You don't need to leave all the demo shader code in there)
Also, look at the Orc's materials.cs file thats in the player folder for an idea of how to do it.