草稿日期。 2021년 7월 13일.

JP Lee is creating Game | Patreon


Preface

After leaving the company after a long time, I am going to research some rendering techniques and post them on Github. By writing this pages, I think I will be able to remind myself of my old memories. So... I want to say that I didn't want to do anything too difficult from the start. It seemed that I would get tired first if I dealt with difficult things from the beginning. 😢 Back to the main text... We try to explain each effect section as simply as possible. As I have been paying attention to team management for several years, personally, my ability to explain in detail technical aspects seems to have decreased, so I will keep the attitude of reminding myself. Most of the explanations are not for programmers, but for artists interested in shading. Rather than relying entirely on rendering programmers or technical artists, if you understand the implementation aspects, artists will be able to organize their thoughts before communicating with them.

离开公司很久之后,我打算研究一些渲染技术并发布在Github上。 通过写这几页,我想我将能够提醒自己我的旧记忆。 所以……我想说,我从一开始就不想做任何太难的事情。 好像从一开始就处理困难的事情,我会先感到疲倦。 😢 回到正文... 我们尝试尽可能简单地解释每个效果部分。 由于我多年来一直关注团队管理,我个人对技术方面的详细解释能力似乎有所下降,所以我会保持提醒自己的态度。 大多数解释不是针对程序员,而是针对对着色感兴趣的艺术家。 与其完全依赖渲染程序员或技术美工,如果您了解实现方面,美工将能够在与他们交流之前组织他们的想法。


In this example, we did not write the shader in the Multi-pass(1) format.

在这个例子中,我们没有以 Multi-pass(1) 格式编写着色器。

<aside> 💡 Rendering is basically Forward rendering and was created in the URP environment. 渲染基本上是前向渲染,是在 URP 环境中创建的。

</aside>

What we can learn from this content. 我们可以从这个内容中学到什么。

Desmos | 그래핑 계산기


基本准备

As an example, I used a character from XRD obtained from the Internet. Of course, you can guess that Normal is edited in the DCC tool. We're not going to use the Normal information we computed directly by Unity. There are some things to check in the mesh's inspector information. Whenever possible, I'll use Import .

例如,我使用了从互联网上获得的 XRD 中的一个字符。 当然,你可以猜到Normal是在DCC工具中编辑的。 我们不会使用 Unity 直接计算的 Normal 信息。 有一些事情需要检查网格的检查器信息。 只要有可能,我就会使用 Import 。

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/9e505e84-4d10-4184-84ac-914d13369bf3/Untitled.png

Since we will not be building our shader with multipass shading we will need 2 materials.

由于我们不会使用多通道着色来构建着色器,因此我们将需要 2 种材质。

  1. OutlineMat.mat for outline rendering. OutlineMat.mat 用于轮廓渲染
  2. ToonShadingMat.mat for real character shading. ToonShadingMat.mat 用于真实字符着色.

Add these two materials to the Assets directory. When you are ready, register two materials in one mesh as shown in the picture below.

将这两种材质添加到 Assets 目录中。 准备好后,在一个网格中注册两种材料,如下图所示。

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/b08a2927-e88e-484a-ac9a-3c30f445a68c/Untitled.png

The order of the materials doesn't matter, as the shaders applied to the OutlineMat will be rendered as Cull Front. 材质的顺序无关紧要,因为应用于 OutlineMat 的着色器将渲染为 Cull Front。

Multi-pass implementation in one shader is equivalent to applying two materials like this. It could be simply conceptually called Multi-pass. I'm going to render the same Mesh Entity twice anyway... Personally, I prefer this method rather than Multi-pass when shading for character effects or other effects.

在一个着色器中实现多通道相当于应用两种这样的材质。 它可以在概念上简单地称为多通道。 无论如何,我将渲染相同的网格实体两次......就我个人而言,在为角色效果或其他效果着色时,我更喜欢这种方法而不是多通道。