ShaderLab에서 패스를 정의하려면 Pass
블록을 사용하십시오. 이 페이지는 Pass
블록을 사용하는 방법에 관한 정보를 포함합니다. 셰이더 오브젝트의 작동 방식 및 셰이더 오브젝트, 서브셰이더와 패스의 관계에 대해 알아보려면 셰이더 오브젝트 기초를 참조하십시오.
패스는 셰이더 오브젝트의 기초 요소로, GPU 상태 및 GPU에서 실행되는 셰이더 프로그램을 설정하기 위한 명령을 포함합니다.
단순한 셰이더 오브젝트는 싱글 패스만 포함할 수 있으나, 보다 복잡한 셰이더는 여러 개의 패스를 포함할 수 있습니다. 셰이더 오브젝트의 서로 다르게 작동하는 부분을 정의하기 위해 별도의 패스를 사용할 수 있습니다(예: 렌더 상태의 변경을 요구하는 부분, 서로 다른 셰이더 프로그램 또는 다른 LightMode
패스 태그).
참고: 스크립터블 렌더 파이프라인에 기반한 렌더 파이프라인에서 RenderStateBlock을 사용하면 별도의 패스를 요구할 필요 없이 GPU에서 렌더 상태를 변경할 수 있습니다.
기능 이름 | 빌트인 렌더 파이프라인 | 유니버설 렌더 파이프라인(URP) | 고해상도 렌더 파이프라인(HDRP) | 커스텀 SRP |
---|---|---|---|---|
ShaderLab: Pass 블록 | 지원 | 지원 | 지원 | 지원 |
ShaderLab에서 일반 패스를 정의하려면 SubShader
블록 안에 Pass
블록을 넣으십시오.
Pass
블록 내에서 다음을 수행할 수 있습니다.
PackageRequirements
블록을 사용하여 패키지 요구 사항을 지정합니다. 그러면 필수 패키지가 설치된 경우에만 Unity가 패스를 실행합니다. ShaderLab: 패키지 요구 사항 지정을 참조하십시오.UsePass
또는 GrabPass
커맨드를 사용하여 두 가지의 특별한 패스 타입을 정의할 수 있습니다. 이러한 커맨드에 관한 내용은 ShaderLab 커맨드: UsePass 또는 ShaderLab 커맨드: GrabPass를 참조하십시오.
서명 | 기능 |
---|---|
Pass { <optional: name> <optional: tags> <optional: commands> <optional: shader code> }
|
패스를 정의합니다. |
이 예제 코드는 싱글 패스를 포함한 단일 서브셰이더를 포함하는 셰이더 오브젝트를 만들기 위한 구문을 나타냅니다.
Shader "Examples/SinglePass"
{
SubShader
{
Pass
{
Name "ExamplePassName"
Tags { "ExampleTagKey" = "ExampleTagValue" }
// ShaderLab commands go here.
// HLSL code 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.