Debug/Release build graphical discrepancies

Started by
2 comments, last by boersch 16 years, 7 months ago
Hi all! I'm having a problem perhaps better explained with images: DEBUG BUILD Above: Debug build DEBUG BUILD Above: Release build As you can (hopefully) see, the shading is different between builds. The debug build looks nice (how I expect it to look) whereas the release build seems to have funky normals/tangents and there are triangle artifacts on the steps shown in the image - which I also suspect to be a result of bad normals/tangents. All of the code, shaders, assets etc. are identical between builds. I've scoured through all of my mesh loading code, my normal/tangent generation, but can't see the problem. Plus everything looks so good in the debug build. So I'm stumped. Are there any caveats to building a Direct3D release app that I don't know about? Can anyone offer any tips for debugging this problem? Any advice is much appreciated. I'm using DirectX April 07 SDK with VS2005. Cheers
Advertisement
You've definitely not got any rogue #ifdef statements lying around?

You have artefacts on your debug steps as well, but curiously the dotted diagonal line runs in the opposite direction to the tearing in the release build. If the dotted lines are triangle boundaries then they're either wrong or your geometry generation code is very different in the release build.

Are you using the D3D debug runtimes? Is it emitting any warnings/errors?

Have you tried stepping through your app using PIX? It's a debugging tool designed for D3D and it can be extremely useful [wink]

The main difference between the debug and runtime compilations is that the debug will intentionally put bogus data into uninitialized variables whereas you'll just get garbage on a release build. But that shouldn't mean it looks correct in debug and wrong in release - it should break the same in both, just more usefully in debug!

hth
Jack

<hr align="left" width="25%" />
Jack Hoxley <small>[</small><small> Forum FAQ | Revised FAQ | MVP Profile | Developer Journal ]</small>

Thanks for the advice, Jack. I'd never used PIX before but it was exactly what I needed.

It turns out that the problem is indeed that the tangents are being corrupted in the release build for some reason - vertex positions, normals and tex coords are all fine. I can't for the life of me figure out why though. I've double and triple checked my code for anything I might have ifdef'd out but no luck. Debug and Release are following the exact same code path, using the exact same assets and the exact same shaders. I've tried using a reference device, but no luck. Turning on the debug runtimes with all the debug information cranked up full is no help either - it complains about some redundant render and sampler state changes which I expected anyway. I tried sending my tangents using a TEXCOORD semantic rather than the TANGENT semantic but still nothing. This leads me to believe that it's something in my code - but then the debug build runs fine! Argh! Is it at all possible that Direct3D could be doing something behind my back? I'll write up a test app separate from the rest of my game to see if I get the same problems. If anyone else has had this problem your input would be appreciated!

I've rendered my tangent vectors to show the difference between release and debug:

DEBUG BUILD
Above: Debug build

RELEASE BUILD
Above: Release build
Solved: it was in my tangent generation, I wasn't initializing my tangent vectors properly before calculating them - the debug build was doing it for me. Thanks again jollyjeffers!

This topic is closed to new replies.

Advertisement