Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In the D3D12Multithreading example, shadow map sampler shouldn't be using D3D11_TEXTURE_ADDRESS_CLAMP mode. #882

Open
CretaceousConstructor opened this issue Aug 15, 2024 · 0 comments
Labels
bug samples Issues related to Samples

Comments

@CretaceousConstructor
Copy link

Any objects outside the frustrum of light camera should be in shadow, and D3D12_TEXTURE_ADDRESS_MODE_BORDER should be used here otherwise its no use setting BorderColor for D3D11_TEXTURE_ADDRESS_CLAMP.
Original code:

        D3D12_SAMPLER_DESC clampSamplerDesc = {};
        clampSamplerDesc.Filter = D3D12_FILTER_MIN_MAG_MIP_POINT;
        clampSamplerDesc.AddressU = D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
        clampSamplerDesc.AddressV = D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
        clampSamplerDesc.AddressW = D3D12_TEXTURE_ADDRESS_MODE_CLAMP;
        clampSamplerDesc.MipLODBias = 0.0f;
        clampSamplerDesc.MaxAnisotropy = 1;
        clampSamplerDesc.ComparisonFunc = D3D12_COMPARISON_FUNC_ALWAYS;
        clampSamplerDesc.BorderColor[0] = clampSamplerDesc.BorderColor[1] = clampSamplerDesc.BorderColor[2] = clampSamplerDesc.BorderColor[3] = 0;
        clampSamplerDesc.MinLOD = 0;
        clampSamplerDesc.MaxLOD = D3D12_FLOAT32_MAX;
        m_device->CreateSampler(&clampSamplerDesc, samplerHandle);

Should be modified to:

        D3D12_SAMPLER_DESC clampSamplerDesc = {};
        clampSamplerDesc.Filter = D3D12_FILTER_MIN_MAG_MIP_POINT;
        clampSamplerDesc.AddressU = D3D12_TEXTURE_ADDRESS_MODE_BORDER;
        clampSamplerDesc.AddressV = D3D12_TEXTURE_ADDRESS_MODE_BORDER;
        clampSamplerDesc.AddressW = D3D12_TEXTURE_ADDRESS_MODE_BORDER;
        clampSamplerDesc.MipLODBias = 0.0f;
        clampSamplerDesc.MaxAnisotropy = 1;
        clampSamplerDesc.ComparisonFunc = D3D12_COMPARISON_FUNC_ALWAYS;
        clampSamplerDesc.BorderColor[0] = clampSamplerDesc.BorderColor[1] = clampSamplerDesc.BorderColor[2] = clampSamplerDesc.BorderColor[3] = 0;
        clampSamplerDesc.MinLOD = 0;
        clampSamplerDesc.MaxLOD = D3D12_FLOAT32_MAX;
        m_device->CreateSampler(&clampSamplerDesc, samplerHandle);
@CretaceousConstructor CretaceousConstructor changed the title In the D3D12Multithreading example, shadow map sampler shouldn't be set D3D11_TEXTURE_ADDRESS_CLAMP. In the D3D12Multithreading example, shadow map sampler shouldn't be using D3D11_TEXTURE_ADDRESS_CLAMP mode. Aug 15, 2024
@walbourn walbourn added bug samples Issues related to Samples labels Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug samples Issues related to Samples
Projects
None yet
Development

No branches or pull requests

2 participants