Game Development Community

Bump Map strangeness

by Stephen Jr. Pfann · in Torque Game Engine Advanced · 01/27/2009 (12:56 am) · 9 replies

Hello fellow Garage Gamers,

I am using TGA 1.8.0 on Mac OS 10.5.6 and was wondering if anyone else has been having this issue I have been facing.

I am finding that when I export a model with bump maps (actually normal maps) as a .dts and import it into TGA, the relief varies between the different polygons. In other words, some groups of polygons have very extreme bump mapping while others have the soft bump mapping I am looking for.

Has any one else encountered this problem, and if so, is there a solution I should use?

Thanks,
Steve Jr.

#1
01/27/2009 (1:01 am)
Can you provide a screenshot of the issue?
#2
01/27/2009 (2:01 am)
Hi Alex,

Thanks for the quick reply. Here is the image:
farm4.static.flickr.com/3462/3231266378_31a3914856.jpg
As you can see, different parts of the wall have different degrees of relief even though it's the same texture and normal map.

Steve Jr.
#3
01/27/2009 (2:05 am)
That is quite odd. What graphics card to you have (e.g. Intel GMA 950, ATI Radeon HD 2600, etc.)? If at all possible, can you upload your test mission so I can take a look at it?
#4
01/28/2009 (3:06 am)
I work on a 2.66 ghz iMac running Mac OS 10.5.6. My graphics card is: ATI Radeon HD 2600 Pro.

I am afraid that I can't upload the mission, as the models are the intellectual property of the company I work for. However, I will see if I can reproduce the results on another model an post that.
#5
01/29/2009 (3:27 am)
I've upload a test file that showcases the problem. It contains a section of wall from one of the models I am working on (managed to get permission from the boss). It also contains the Monkey head model that comes with Blender. Both are textured with an image from Torque that I converted into .png. Click here to download the file.

The wall's relief is almost entirely affected by the problem. A few polygons on the wall and the entire Monkey head look fine.

Thanks for looking into this.

Steve Jr.
#6
01/29/2009 (10:00 am)
Edit: After running this by a couple of artists they say the UV's shouldn't be problematic, but chances are something else in the model is. Either way, this is the first model we've seen in 4+ years that has bad tangents, so this is almost certainly an art/exporter issue.
#7
01/30/2009 (4:45 am)
Thanks for the advice. I'm using the DTS exporter for Blender on my models. I upgraded to the latest version (0.97 beta), and now the models seem to come out fine.

Thanks again for your help in solving the issue!

Steve Jr.

P.S. How can I check the texture coordinates like you mentioned?

#8
01/31/2009 (1:10 am)
After loading a mission with your model with a debug build of the engine, open the console and look for a line like this
Material Info for object castlestone - castlestone
  [0]    Program: 189   Vertex Path: shaders/procedural/shaderV_c0410004.glsl  
 Pixel Path: shaders/procedural/shaderP_c0410004.glsl
This line tells us that the castlestone material (which is the material your mesh was using in this case) is rendering with the shaders located at shaders/procedural/shaderV_c0410004.glsl and shaders/procedural/shaderP_c0410004.glsl.

Since these shaders were generated by ShaderGen we will have to disable ShaderGen to prevent it from stomping any changes we make. In TGEA 1.8.0 and earlier you can disable ShaderGen by opening shaderGen.cpp and commenting out
#define GEN_NEW_SHADERS
at the beginning of the file. In TGEA 1.8.1 and later you can disable ShaderGen by setting $ShaderGen::GenNewShaders to false (there's a commented out line in common/main.cs to do exactly this).

Once ShaderGen has been disabled, you can edit the procedural shaders. To examine the texture coordinates for this mesh I added
gl_FragColor = vec4(outTexCoord, 0.0, 1.0);
to the end of shaderP_c0410004.glsl.

In TGEA 1.8.1 and later this entire process can be done without ever leaving the mission. After finding the shader and making the necessary changes, you can open the console, set $ShaderGen::GenNewShaders to false, and then use the reloadMaterials(); command to reload all materials and shaders from disk. When you are done, you can set $ShaderGen::GenNewShaders to true and use the reloadMaterials(); command again to cause ShaderGen to recreate all of its shaders.
#9
02/03/2009 (12:10 am)
Thanks!