Quick Reference
point -> nearest texel, pixel-art·정확한 index
linear -> 이웃 texel 보간, 일반 color texture
anisotropic -> 비스듬한 표면의 texture detail 개선
wrap -> UV 바깥을 반복
clamp -> 가장자리 texel 유지
border -> 지정 border color 반환
comparison -> depth comparison sampling, shadow map 등Texture resource와 Sampler는 별도 객체입니다. 같은 SRV도 material마다 다른 sampler로 읽을 수 있습니다.
Description 항목
Filter는 minification, magnification, mip interpolation 조합을 정합니다. Anisotropic filter를 쓰면 MaxAnisotropy를 유효 범위로 설정합니다. MinLOD와 MaxLOD는 사용할 mip 범위를 제한하고 MipLODBias는 선택 LOD에 offset을 더합니다.
D3D11_SAMPLER_DESC 필드 | CD3D11_SAMPLER_DESC(D3D11_DEFAULT) | 변경 기준 |
|---|---|---|
Filter | MIN_MAG_MIP_LINEAR | point·linear·anisotropic·comparison 선택 |
AddressU/V/W | CLAMP | 반복은 WRAP, atlas·edge는 clamp/border 검토 |
MipLODBias | 0 | mip 선택을 의도적으로 선명·흐리게 조정할 때 |
MaxAnisotropy | 1 | anisotropic filter에서 1..16 범위 사용 |
ComparisonFunc | NEVER | SampleCmp depth 비교 규칙 지정 |
BorderColor[4] | (1,1,1,1) | BORDER address에서 반환할 색 지정 |
MinLOD / MaxLOD | -FLT_MAX / FLT_MAX | sampling 가능한 mip 범위 제한 |
Raw D3D11_SAMPLER_DESC{}는 유효한 default sampler가 아닙니다. 특히 zero 초기화된 address mode와 filter enum을 그대로 CreateSamplerState에 넘기지 말고 모든 필드를 채웁니다.
Address mode는 U, V, W 축마다 지정합니다. Normal map이나 atlas edge에서 wrap이 켜지면 반대쪽 texel이 섞일 수 있어 clamp와 padding을 함께 검토합니다.
Comparison sampler는 comparison filter, ComparisonFunc와 HLSL SampleCmp 계열을 맞춰야 합니다. 일반 color sampling에 comparison filter를 사용하지 않습니다.
자주 틀리는 점
- Linear filtering이 texture 해상도를 실제로 높이지는 않습니다.
- Anisotropic filtering 비용과 품질은 hardware·angle·mip에 따라 달라집니다.
- Sampler를 만들었지만 shader stage와 slot에 bind하지 않으면 효과가 없습니다.
- sRGB 변환은 sampler가 아니라 view format과 shader color contract에서 처리합니다.
참고 링크
2 sources