GPU에서 뎁스 바이어스를 설정합니다.
뎁스 오프셋이라고도 하는 뎁스 바이어스는 지오메트리를 그리는 뎁스를 결정하는 GPU의 설정입니다. 뎁스 바이어스를 조정하여 GPU가 같은 뎁스의 지오메트리 위로 지오메트리를 드로우하도록 강제할 수 있습니다. 이를 통해 Z 파이팅과 섀도우 애크니와 같은 원하지 않는 시각적 효과를 방지할 수 있습니다.
특정 지오메트리의 뎁스 바이어스를 설정하려면 이 커맨드나 RenderStateBlock을 사용하십시오. 모든 지오메트리에 영향을 미치는 전역 뎁스 바이어스를 설정하려면 CommandBuffer.SetGlobalDepthBias를 사용하십시오. GPU는 전역 뎁스 바이어스와 함께 추가로 특정 지오메트리의 뎁스 바이어스를 적용합니다.
섀도우 애크니를 줄이려면 광원 바이어스 설정으로 비슷한 시각적 효과를 얻을 수 있습니다. 단, 이러한 설정은 작동 방식이 다르며 GPU 상태를 변경하지 않습니다. 자세한 내용은 그림자 문제 해결을 참조하십시오.
기능 이름 | 빌트인 렌더 파이프라인 | 유니버설 렌더 파이프라인(URP) | 고해상도 렌더 파이프라인(HDRP) | 커스텀 SRP |
---|---|---|---|---|
Offset | 지원 | 지원 | 지원 | 지원 |
이 커맨드는 렌더 상태를 변경합니다. Pass
블록에서 사용하여 해당 패스의 렌더 상태를 설정하거나, SubShader
블록에서 사용하여 해당 서브셰이더에 있는 모든 패스의 렌더 상태를 설정할 수 있습니다.
서명 | 예제 구문 | 기능 |
---|---|---|
Offset <factor>, <units> |
Offset 1, 1 |
특정한 값에 기반하여 카메라에 더 가까이 혹은 카메라에서 더 멀리로 지오메트리를 드로우할 수 있습니다. |
파라미터 | 값 | 기능 |
---|---|---|
factor | –1 - 1 범위의 플로트. | 뎁스 경사라고도 하는 최대 Z 경사를 스케일하여 각 폴리곤의 가변 뎁스 오프셋을 만듭니다. 가까운 클립 평면과 먼 클립 평면과 병렬이 아닌 폴리곤은 Z 경사가 있습니다. 이러한 폴리곤의 시각적 결함을 방지하려면 이 값을 조정하십시오. |
units | –1 - 1 범위의 플로트. | 최소 분석 가능 뎁스 버퍼 값을 스케일합니다. 최소 뎁스 분석 가능 뎁스 버퍼 값(one unit)은 기기별로 다릅니다. 음의 값은 GPU가 폴리곤을 카메라에 더 가까이 드로우한다는 뜻입니다. 양의 값은 GPU가 폴리곤을 카메라에서 더 멀리로 드로우한다는 뜻입니다. |
이 예제 코드는 Pass 블록에서 이 커맨드를 사용하기 위한 구문을 나타냅니다.
Shader "Examples/CommandExample"
{
SubShader
{
// The rest of the code that defines the SubShader goes here.
Pass
{
// Sets the depth offset for this geometry so that the GPU draws this geometry closer to the camera
// You would typically do this to avoid z-fighting
Offset -1, -1
// The rest of the code that defines the Pass goes here.
}
}
}
이 예제 코드는 SubShader 블록에서 이 커맨드를 사용하기 위한 구문을 나타냅니다.
Shader "Examples/CommandExample"
{
SubShader
{
// Sets the depth offset for this geometry so that the GPU draws this geometry closer to the camera
// You would typically do this to avoid z-fighting
Offset -1, -1
// The rest of the code that defines the SubShader goes here.
Pass
{
// The rest of the code that defines the Pass goes here.
}
}
}
Did you find this page useful? Please give it a rating:
Thanks for rating this page!
What kind of problem would you like to report?
Thanks for letting us know! This page has been marked for review based on your feedback.
If you have time, you can provide more information to help us fix the problem faster.
Provide more information
You've told us this page needs code samples. If you'd like to help us further, you could provide a code sample, or tell us about what kind of code sample you'd like to see:
You've told us there are code samples on this page which don't work. If you know how to fix it, or have something better we could use instead, please let us know:
You've told us there is information missing from this page. Please tell us more about what's missing:
You've told us there is incorrect information on this page. If you know what we should change to make it correct, please tell us:
You've told us this page has unclear or confusing information. Please tell us more about what you found unclear or confusing, or let us know how we could make it clearer:
You've told us there is a spelling or grammar error on this page. Please tell us what's wrong:
You've told us this page has a problem. Please tell us more about what's wrong:
Thank you for helping to make the Unity documentation better!
Your feedback has been submitted as a ticket for our documentation team to review.
We are not able to reply to every ticket submitted.