지오메트리가 뎁스 테스트를 통과하거나 이에 실패하는 조건을 설정합니다.
뎁스 테스트는 “Early-Z” 기능이 있는 GPU가 파이프라인 초기에 지오메트리를 거절하도록 허용하고, 지오메트리의 올바른 순서 지정을 보장합니다. 뎁스 테스트 조건을 변경하여 오브젝트 오클루전과 같은 시각적 효과를 구현할 수 있습니다.
기능 이름 | 빌트인 렌더 파이프라인 | 유니버설 렌더 파이프라인(URP) | 고해상도 렌더 파이프라인(HDRP) | 커스텀 SRP |
---|---|---|---|---|
ZTest | 지원 | 지원 | 지원 | 지원 |
이 커맨드는 렌더 상태를 변경합니다. Pass
블록에서 사용하여 해당 패스의 렌더 상태를 설정하거나, SubShader
블록에서 사용하여 해당 서브셰이더에 있는 모든 패스의 렌더 상태를 설정할 수 있습니다.
서명 | 예제 구문 | 기능 |
---|---|---|
ZTest [operation] | ZTest Less | 지오메트리가 뎁스 테스트를 통과하거나 이에 실패하는 조건을 설정합니다. |
파라미터 | 값 | 기능 |
---|---|---|
operation | Less | 기존 지오메트리 앞에 있는 지오메트리를 드로우합니다. 기존 지오메트리와 같은 거리에 있거나 기존 지오메트리 뒤에 있는 지오메트리는 드로우하지 않습니다. |
LEqual | 기존 지오메트리 앞에 있거나 기존 지오메트리와 같은 거리에 있는 지오메트리를 드로우합니다. 기존 지오메트리 뒤에 있는 지오메트리는 드로우하지 않습니다. 기본값에 해당합니다. |
|
Equal | 기존 지오메트리와 같은 거리에 있는 지오메트리를 드로우합니다. 기존 지오메트리 앞에 있거나 기존 지오메트리 뒤에 있는 지오메트리는 드로우하지 않습니다. | |
GEqual | 기존 지오메트리 뒤에 있거나 기존 지오메트리와 같은 거리에 있는 지오메트리를 드로우합니다. 기존 지오메트리 앞에 있는 지오메트리는 드로우하지 않습니다. | |
Greater | 기존 지오메트리 뒤에 있는 지오메트리를 드로우합니다. 기존 지오메트리와 같은 거리에 있거나 기존 지오메트리 앞에 있는 지오메트리는 드로우하지 않습니다. | |
NotEqual | 기존 지오메트리와 같은 거리에 있지 않은 지오메트리를 드로우합니다. 기존 지오메트리와 같은 거리에 있는 지오메트리는 드로우하지 않습니다. | |
Always | 뎁스 테스트가 실행되지 않습니다. 거리와 관계없이 모든 지오메트리를 드로우합니다. |
이 예제 코드는 Pass 블록에서 이 커맨드를 사용하기 위한 구문을 나타냅니다.
Shader "Examples/CommandExample"
{
SubShader
{
// The rest of the code that defines the SubShader goes here.
Pass
{
// Sets the depth test operation to Equal for all pixels in this Pass
// You would typically do this if you want to render the geometry exactly where already rendered geometry is
ZTest Equal
// The rest of the code that defines the Pass goes here.
}
}
}
이 예제 코드는 SubShader 블록에서 이 커맨드를 사용하기 위한 구문을 나타냅니다.
Shader "Examples/CommandExample"
{
SubShader
{
// Sets the depth test operation to Equal for all pixels in this Pass
// You would typically do this if you want to render the geometry exactly where already rendered geometry is
ZTest Equal
// 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.