Hi there!
I'm working on a deferred rendering system for a game I'm building, and am having trouble with the final lighting shader. I have three render targets that I'm passing in to the shader, but it only seems to be sampling from the first.
So my lighting shader is set up like this :
Texture2D ColourMap;
SamplerState ColourSampler
{
Texture = (ColourMap);
AddressU = CLAMP;
AddressV = CLAMP;
MagFilter = LINEAR;
MinFilter = LINEAR;
MipFilter = LINEAR;
};
Texture2D NormalMap;
SamplerState NormalSampler
{
Texture = (NormalMap);
AddressU = CLAMP;
AddressV = CLAMP;
MagFilter = POINT;
MinFilter = POINT;
MipFilter = POINT;
};
Texture2D DepthMap;
SamplerState DepthSampler
{
Texture = (DepthMap);
AddressU = CLAMP;
AddressV = CLAMP;
MagFilter = POINT;
MinFilter = POINT;
MipFilter = POINT;
};
...
float4 PS( PixelShaderInput anInput ) : SV_TARGET
{
// lighting bits and pieces
}
And in my pixel shader, returning a sample from the colour target :
return ColourMap.Sample( ColourSampler, anInput.myTexCoords );
Produces the same out put as :
return NormalMap.Sample( NormalSampler, anInput.myTexCoords );
I've been saving the colour and normal targets to screenshots (.dds format) and can confirm that they're different... in fact now I'm just filling my normal render target up with (1.0f, 0.0f, 0.0f) to be safe.
This is how I'm setting my sampler states :
ID3D11ShaderResourceView* shaderResources[] = { myColourTarget->myShaderResource, myNormalTarget->myShaderResource, myDepthTarget->myShaderResource };
shader->SetShaderResources( shaderResources, 3 )
...
SetShaderResources( ID3D11ShaderResourceView** someShaderResources, int aShaderResourceCount )
{
myDeviceContext->PSSetSHaderResources( 0, aShaderResourceCount, someShaderResources );
}
Anything obvious that I'm not spotting here?
Thanks for your help!