Turns out that I had made a stupid mistake in my normal-mapping shader, something that's almost embarassing to admit to:
float3 normal = normalize( texNormalMap.Sample( DefaultSampler, v.texcoord ).rgb );
Should actually have been:
float3 normal = normalize( texNormalMap.Sample( DefaultSampler, v.texcoord ).rgb * 2.0f - 1.0f );
Almost as stupid as the time I forgot to specify .rgb and my normalization was working on a 4D instead of 3D vector. That was an odd mistake to track down and fix... [headshake]
In order to write the book so as to rely on as little "non standard" technology as possible I'm using D3DX10ComputeNormalMap() to generate the input data at load-time. Problem is it's either poorly documented or just broken - probably a bit of both.
I've only found one format (DXGI_FORMAT_R8G8B8_UNORM) that works - but you can feed in other formats and get partial/odd results back. Not sure if that means the documentation isn't specific enough, or the function shouldn't have restrictions but has a bug that effectively forces it to...
It also seems that the function AddRef()'s something internally and causes a memory leak. Or, at least it does something to make DXUT choke (the runtimes themselves don't report any leaks).
As it stands I'm a little concerned about writing it into the final book text unless it gets fixed. Thankfully I've got at least a couple of SDK's to hope they fix things [smile]
I also had a run in with state blocks this evening. Part of the video I'm preparing (hopefully have it read for you soon [wink]) starts with a wireframe rendering. So I set up the appropriate code for this, then wonder why wireframe mode never turns itself off.
Yup, FX10 changes things and it doesn't automagically handle states the same as FX9 does [rolleyes]
So I now have to box my rendering code like so:
pTechniqueHandle->ComputeStateBlockMask( &mask );
CComPtr< ID3D10StateBlock > pStateBlock;
if( SUCCEEDED( D3D10CreateStateBlock( pd3dDevice, &mask, &pStateBlock ) ) )
if( SUCCEEDED( pStateBlock->Capture( ) ) )
// Perform rendering here
Anyway, the fruit of my labour:
I need to work on some better art-work. Currently It's just a simple N-dot-L output, but I want to put some diffuse texture so that I can prove another point later on...