microsoft / microsoft/DirectX-Graphics-Samples
In the D3D12Multithreading example, shadow map sampler shouldn't be using D3D11_TEXTURE_ADDRESS_CLAMP mode.
Open
Nobody has claimed this yet.
bug
samples
- Dominant language
- C++
- Stars
- 6.8k
- Forks
- 2.2k
- PR merge metrics
- No merged PRs in 30d
Description
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);
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Open the D3D12Multithreading example and locate the shadow-map sampler descriptor shown in the issue. Change its U, V, and W address modes to BORDER while retaining the specified border color, then build or run the example to verify the sampler behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp
- Domain
- computer-graphics
- Issue type
- Bug
- Difficulty
- 1/5
- Estimated time
- Under an hour
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 55/100