Detail textures
by Rob Evans · in Torque Game Engine Advanced · 07/19/2007 (3:37 am) · 23 replies
I'm adding a detail texture to my material that will be applied to a sphere (planet in game) but the detail texture won't show up. I've tried a number of different approaches. The console doesn't show any errors when loading the material file and the bump and specular are working.
Here is my material:
Any ideas?
Here is my material:
new Material(PlanetBump)
{
baseTex[0] = "earthMap4";
bumpTex[0] = "earthMap4_bump";
detailTex[0] = "detail1";
pixelSpecular[0] = false;
specular[0] = "0.1 0.1 0.1 1.0";
specularPower[0] = 20.0;
};Any ideas?
#22
First, I have found nothing in the code that suggests that detailTex needs to be specified differently. Not regarding the path or the extension. All the texture names are read in a consistent fashion and if your materials.cs file is in the same folder as your textures, it is acceptable to just give the name, sans extension.
What I did find looking at the procedural shaders is that usage of detailTex also depends on a detailScale value that is passed into a vertex shader. However, after searching the code, I found that the detailScale is never set. There is some code for setting it material.cpp but it's commented out. Uncommented, it sets the detailScale to 2.
Once I enabled this code, the detailTex started to work, and I could adjust the tile scale by changing the hard-coded scale value. It works just great actually, exactly as I would expect.
What I don't know is what value the vertex shader is getting for detailScale when it's never defined. I wonder if it's like an uninitialized value that might change every time you recompile. That may explain why it suddenly started working for Rob, but not as a result of the changes he made. He just got lucky and detailScale got set to a reasonable value.
07/23/2007 (4:53 pm)
I was able to get detailTex to work, but not in any way consistent with what has been described in this post.First, I have found nothing in the code that suggests that detailTex needs to be specified differently. Not regarding the path or the extension. All the texture names are read in a consistent fashion and if your materials.cs file is in the same folder as your textures, it is acceptable to just give the name, sans extension.
What I did find looking at the procedural shaders is that usage of detailTex also depends on a detailScale value that is passed into a vertex shader. However, after searching the code, I found that the detailScale is never set. There is some code for setting it material.cpp but it's commented out. Uncommented, it sets the detailScale to 2.
Once I enabled this code, the detailTex started to work, and I could adjust the tile scale by changing the hard-coded scale value. It works just great actually, exactly as I would expect.
What I don't know is what value the vertex shader is getting for detailScale when it's never defined. I wonder if it's like an uninitialized value that might change every time you recompile. That may explain why it suddenly started working for Rob, but not as a result of the changes he made. He just got lucky and detailScale got set to a reasonable value.
#23
Thanks for bringing it up, and thanks for the follow-up Jeff.
07/23/2007 (6:24 pm)
I'll bump this up, that certainly sounds non-standard. All best practices info I have simply says to define a texture directly when you want the texture, and it does look inconsistent in use currently.Thanks for bringing it up, and thanks for the follow-up Jeff.
Torque Owner Rob Evans
I added a line vertexSpecular[0] = false; just as a shot in the dark to see if that might be affecting my issue to do with lighting but other than that, the only change is the path on the detail tex.