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:
D3D10_STATE_BLOCK_MASK mask;pTechniqueHandle->ComputeStateBlockMask( &mask );CComPtr< ID3D10StateBlock > pStateBlock;if( SUCCEEDED( D3D10CreateStateBlock( pd3dDevice, &mask, &pStateBlock ) ) ){ if( SUCCEEDED( pStateBlock->Capture( ) ) ) { // Perform rendering here pStateBlock->Apply( ); }}
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...
What ever happened to the water demo you were working on a while ago? I was looking forward to seeing what you came up with. Last I remember you had the framework setup with the terrain/water plane.
Also I still say you should splurge and buy a 20" 4:3 LCD AND a 27" widescreen LCD...who cares if you've got to mortgage your left nut...it's worth it trust me [grin].
Take it easy man, keep up the good work.
- Dan