Skip to content

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

Open

Description

@CretaceousConstructor

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);

Activity

  1. 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.[/+] on Aug 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugsamplesIssues related to Samples

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions