[1.1 Beta Bug] Some Materials with Specular Render Wrong - LOGGED
by Ryan Mounts · in Torque 3D Professional · 02/11/2010 (11:13 am) · 10 replies
*** EDIT ***
After playing a little more, other objects' specularity work fine. And if I remove the normal map from the station material, its specular works properly. But for some reason, no matter what normal map I use in the station material, I get the results shown below for the Deathball example. If I put a different material on the station in the Deathball example, normals + specular works. And in the Full template, the station works properly with normals + specular. So it looks like there's a problem with the default station material in the Deathball example.
************
When I set a material to use specular, it completely messes up the material. Specular worked fine in all previous versions. Top image: no specular. Bottom image: with specular.
Intel Core 2, ~1.99 Ghz
NVIDIA Quadro NVS 135M

After playing a little more, other objects' specularity work fine. And if I remove the normal map from the station material, its specular works properly. But for some reason, no matter what normal map I use in the station material, I get the results shown below for the Deathball example. If I put a different material on the station in the Deathball example, normals + specular works. And in the Full template, the station works properly with normals + specular. So it looks like there's a problem with the default station material in the Deathball example.
************
When I set a material to use specular, it completely messes up the material. Specular worked fine in all previous versions. Top image: no specular. Bottom image: with specular.
Intel Core 2, ~1.99 Ghz
NVIDIA Quadro NVS 135M

#2
No shader errors in the log. I did notice however, that only the Building02Walls material is having this problem. Looking at the differences between this material and the other materials in the level, the Building02Walls has a Detail Normal Map in the Advanced Texture Maps that the others do not. Here's what I'm seeing:
1. If I remove the Detail Normal Map, the specular works fine with the regular Normal Map.
2. If I remove the regular Normal Map, the specular seems to work but is unaffected by the Detail Normal Map. Changing the Detail Normal Map strength or the Detail Map tiling does not affect the specular highlight.
So to summarize, "Normal Map + Detail Normal Map + Specular" leads to the image above. Removing either or both normal maps causes specular to work, but the Detail Normal Map does not seem to affect the final image.
02/15/2010 (3:56 pm)
Hey Tom,No shader errors in the log. I did notice however, that only the Building02Walls material is having this problem. Looking at the differences between this material and the other materials in the level, the Building02Walls has a Detail Normal Map in the Advanced Texture Maps that the others do not. Here's what I'm seeing:
1. If I remove the Detail Normal Map, the specular works fine with the regular Normal Map.
2. If I remove the regular Normal Map, the specular seems to work but is unaffected by the Detail Normal Map. Changing the Detail Normal Map strength or the Detail Map tiling does not affect the specular highlight.
So to summarize, "Normal Map + Detail Normal Map + Specular" leads to the image above. Removing either or both normal maps causes specular to work, but the Detail Normal Map does not seem to affect the final image.
#3
1) diffuse map
2) detail map
3) bump map
4) detail bump map
5) lightInfobuffer
6) fizz map
But when I looked at the procedural pixel shader that was set for this draw, it only has five sampler2D inputs with no detail bump map:
If I run PIX again, turn off the specular (now it renders correctly), and grab a frame, I see four textures set (the two bump maps are not passed) and the procedural pixel shader has the corresponding four sampler2D inputs.
I don't know if this is causing the problem, but it definitely doesn't look right to me.
02/18/2010 (1:41 pm)
Let me preface this by stating that I'm not very experienced in DiretX programming or shaders, so this area of the engine is not my forte. :) In any event, I noticed something interesting. I used PIX to look at a frame like the bottom one above. Before drawing the building02walls material (w/ specular on), six IDirect3DDevice::SetTexture() calls are made to set:1) diffuse map
2) detail map
3) bump map
4) detail bump map
5) lightInfobuffer
6) fizz map
But when I looked at the procedural pixel shader that was set for this draw, it only has five sampler2D inputs with no detail bump map:
Fragout main( ConnectData IN,
uniform sampler2D diffuseMap : register(S0),
uniform sampler2D detailMap : register(S1),
uniform sampler2D bumpMap : register(S2),
uniform float4 rtParams4 : register(C3),
uniform sampler2D lightInfoBuffer : register(S3),
uniform float4 specularColor : register(C0),
uniform float specularPower : register(C1),
uniform float visibility : register(C2),
uniform sampler2D fizzMap : register(S4),
uniform float2 fizzScale : register(C4)
)If I run PIX again, turn off the specular (now it renders correctly), and grab a frame, I see four textures set (the two bump maps are not passed) and the procedural pixel shader has the corresponding four sampler2D inputs.
I don't know if this is causing the problem, but it definitely doesn't look right to me.
#4
The issue is the 'rtParams4' in your snippit of the pixel shader above. That should actually be rtParams3... this is causing it to read the wrong shader constant causing problems.
The fix... in source\lighting\advanced\hlsl\advancedLightingFeaturesHLSL.cpp around line 363 in function DeferredBumpFeatHLSL::getResources:
Then a little further below in DeferredBumpFeatHLSL::setTexData line 394:
Let me know if it solves this issue for you.
02/21/2010 (4:35 pm)
I found and fixed this bug.The issue is the 'rtParams4' in your snippit of the pixel shader above. That should actually be rtParams3... this is causing it to read the wrong shader constant causing problems.
The fix... in source\lighting\advanced\hlsl\advancedLightingFeaturesHLSL.cpp around line 363 in function DeferredBumpFeatHLSL::getResources:
Resources res;
if(!fd.features[MFT_SpecularMap])
{
res.numTex = 1;
res.numTexReg = 1;
if ( fd.features[MFT_PrePassConditioner] && // ADDED!
fd.features.hasFeature( MFT_DetailNormalMap ) )
{
res.numTex += 1;
if ( !fd.features.hasFeature( MFT_DetailMap ) )
res.numTexReg += 1;
}Then a little further below in DeferredBumpFeatHLSL::setTexData line 394:
if ( !fd.features[MFT_Parallax] && !fd.features[MFT_SpecularMap] &&
( fd.features[MFT_PrePassConditioner] ||
fd.features[MFT_PixSpecular] ) )
{
passData.mTexType[ texIndex ] = Material::Bump;
passData.mTexSlot[ texIndex++ ].texObject = stageDat.getTex( MFT_NormalMap );
if ( fd.features[MFT_PrePassConditioner] && // ADDED!
fd.features.hasFeature( MFT_DetailNormalMap ) )
{
passData.mTexType[ texIndex ] = Material::DetailBump;
passData.mTexSlot[ texIndex++ ].texObject = stageDat.getTex( MFT_DetailNormalMap );
}Let me know if it solves this issue for you.
#5
Thanks for the fix. :)
02/24/2010 (3:15 pm)
Works like a charm! Good job, Tom. The only thing I'm wondering about is if I remove the bump map, leaving the detail bump map there, the specular highlight is not affected by the detail bump map. In other words, the specular hightlight is smooth and unperturbed by the detail bump map alone. I'm assuming this is not the desired behavior... any thoughts?Thanks for the fix. :)
#6
I'll have to look into that one... thanks for reporting it.
THREED-893
02/26/2010 (5:36 pm)
Quote:the specular highlight is not affected by the detail bump map.Hum... anyone else seen this same behavior?
I'll have to look into that one... thanks for reporting it.
THREED-893
#7
1xNormal + 1xDetailNormal = both specular highlights
0xNormal but 1xDetailNormal = no specular at all
02/26/2010 (7:03 pm)
Yep, I can see that. 1xNormal + 1xDetailNormal = both specular highlights
0xNormal but 1xDetailNormal = no specular at all
#9
The issue is that the detail normal map feature itself depends on their being a normal map. Fixing that is gonna be hard and really i don't see too many cases where you want just a detail normal map alone. If you really want that right now... use a dummy normal map with no features.
02/27/2010 (2:29 pm)
Ahhh.... i get what your saying now. If you have a detail normal map and no normal map.The issue is that the detail normal map feature itself depends on their being a normal map. Fixing that is gonna be hard and really i don't see too many cases where you want just a detail normal map alone. If you really want that right now... use a dummy normal map with no features.
#10
02/27/2010 (7:37 pm)
Gotcha. I thought that might be the case. All's good then! :)
Associate Tom Spilman
Sickhead Games
Any shader errros in the console log when that happens?