Render Queue

作用与原理

默认队列分层

队列值 内置名称 用途描述
1000 Background 天空盒、背景元素
2000 Geometry 标准不透明物体(默认)
2450 AlphaTest 需AlphaTest的物体(树叶)
3000 Transparent 半透明物体(玻璃/粒子)
4000 Overlay UI/屏幕空间特效

C#中修改排序

CSHARP
material.renderQueue = (int)RenderQueue.Transparent + 10; // 3010
点击展开查看更多

URP特有优化与限制

特性 说明
单Pass前向渲染 所有光源单次计算,队列分组很关键
SRP Batcher 同Shader不同Queue值会打断批处理
深度纹理生成 仅对Queue≤2500的物体生成深度纹理
法线纹理生成 需要显式声明DepthNormals Pass

URP的RenderType

RenderType值 Queue队列范围 URP处理阶段 深度纹理
Opaque ≤2500 不透明物体阶段
Transparent >2500 透明物体阶段
Overlay ≥4000 后处理之后

例子

GLSL
// 不透明物体
Tags {
    "RenderPipeline"="UniversalPipeline"
    "RenderType"="Opaque"
    "Queue"="Geometry" // 2000
}

// 透明物体
Tags {
    "RenderPipeline"="UniversalPipeline"
    "RenderType"="Transparent"
    "Queue"="Transparent+100" // 3100
}
点击展开查看更多

版权声明

作者: Chaim

链接: https://chaim.eu.org/posts/%E6%B8%B2%E6%9F%93%E9%98%9F%E5%88%97-render-queue/

许可证: CC BY-NC-SA 4.0

This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License. Please attribute the source, use non-commercially, and maintain the same license.

开始搜索

输入关键词搜索文章内容

↑↓
ESC
⌘K 快捷键