目录索引
译文
要想开始我们的着色器(shader)学习之路,我们需要先在 Unity 中创建一个项目。如果你使用 Unity Hub 进行项目管理,那么我建议你使用较新的 Unity 版本(例如2019、2020、2021或更新的版本)创建项目。
为了更好的理解图形编程语言,让我们从创建内置渲染管线(Built-in RP)的 3D 项目模板开始。项目创建完成后,我们需要单击菜单栏的资产选项(快捷键:ctrl + 5 或 cmd + 5),转到 “创建(create)”,然后选择 “着色器(shader)”选项。
![图片[1]-《Unity着色器圣经》2.0.3 | 着色器的种类-软件开发学习笔记](https://gamedevfan.cn/wp-content/uploads/2025/05/image-21-1024x364.jpeg)
正如我们在选项卡中所见,着色器的类型不止一种,其中有:
- 标准表面着色器
- 无光照着色器
- 屏幕特效着色器
- 计算着色器
- 光线追踪着色器
选项卡中展示的着色器列表可能会根据创建项目时使用的 Unity 版本而有所不同。另一个可能影响列表中着色器数量的是 Shader Graph。除此之外,如果项目使用了通用渲染管线(Universal RP)或高清渲染管线(High Definition RP),可能包含 Shader Graph 包,也会增加可创建着色器的数量。
我们暂时不会详细讨论这个问题,因为在开始使用之前,我们必须了解一些概念,所以我们只使用内置渲染管线中默认的几种着色器。
在创建第一个着色器之前,我们先来回顾一下这几种不同类型着色器。
原文对照
To start creating a shader, we must first create a new project in Unity. If you are using Unity Hub it is recommended to create the project in the most recent versions of the software (e.g. 2019, 2020 or 2021).
We are going to need a 3D template with Built-in RP to facilitate the understanding of the graphics programming language. Once the project has been created, we must right-click on our Project Window (ctrl + 5 or cmd + 5), go to Create and select the Shader option.
![图片[1]-《Unity着色器圣经》2.0.3 | 着色器的种类-软件开发学习笔记](https://gamedevfan.cn/wp-content/uploads/2025/05/image-21-1024x364.jpeg)
As we can see, there is more than one type of shader, among them, we can find:
- Standard Surface Shader.
- Unlit Shader.
- Image Effect Shader.
- Compute Shader.
- Ray Tracing Shader.
The list of shaders is likely to vary depending on the version of Unity used to create the project. Another variable that could affect the number of shaders that appear in the list would be Shader Graph. If the project were created in Universal RP or High Definition RP, it may have the Shader Graph package included, which increases the number of shaders that can be created.
We will not go into details about this subject for now; since we must understand some concepts before starting with it, we will simply limit ourselves to work with the shaders that come by default in Built-in RP.
Before creating our first shader, we will do a little review of the different types that exist in the software.
暂无评论内容