[Unity Shaders] Summary of Unity Shaders and Effects Cookbook, shadersmodcore
My nagging
Unconsciously, it has been nearly ten months since I published my first article about Unity Shaders and Effects Cookbook. At the beginning, I started to take notes. After all, when I look back, I will inevitably feel impatient when I look at English again. From the very beginning, I was almost the only one who had struggled. Now, sometimes someone has learned to leave a message or sent an email to encourage me. I am very happy to be able to learn with me. Thank you for your encouragement and support ~
Let me first talk about the features of this series in my blog ~
- First of all, I declare that this is not a pure translation. Most of my illustrations are put into my blog after step-by-step practice in my Unity.
- Some errors in the original text are corrected.
- It adds your understanding and extension to the part that is rarely explained in the original text.
- In the original article, if I think it is too long, I will not translate them into details... However, I think that even if no average person can understand it ~
So here is the reading method of this book ~
Advantages:
- It fills in the gaps in Unity Shaders at home and abroad (right, right, including abroad. In the past, most of them relied on the resources of Unity documents, forums, and various websites for learning. Now there is a concentrated book. On foreign websites (such as packtpub and Amazon), this book is about 4 stars, which is an acceptable score.
- It contains a wide range of content. From the basic diffuse light, mirror reflection, Cubemap, etc., to the Cloth, Skin (Skin this must be spit... It's really not like skin !), Optimization on the mobile platform, how to use Cg, and finally several advanced topics about image effects. For beginners, the content is rich and interesting.
- Writing Shader has always been a difficult task and does not know how to start. This book provides a simple and effective way.
Disadvantages:
- There are many reasons why this book is not classic (of course, I am very grateful to the author ). What I feel most deeply is that the author has too few introductions on many of the surface pages, so I feel a little bit of it. For example, Shader pipeline. These are actually very important, but I don't know why they are the biggest culprit in blocking the growth of many programmers. If you want to fully understand it, you still need to read a lot of basic data or articles, such as Nvidia's tutorial on Cg.
- The explanation is sometimes too simple. Although the author sometimes says it is very simple, for beginners, the question of "why is this?" often appears in my mind... Of course, writing a Shader is actually an empirical work. The formulas and coefficients are the results of a long term, and there are not many reasons.
- Some errors. For example, the author's usage of variable types is confusing, especially the use of fixed. I will review it later...
- Although it is called cookbook, many of them cannot be used directly. Therefore, this book is an introductory book to help you understand the common usage and syntax of Unity Shader.
Summary
Well, for the convenience of review and indexing, the following describes and summarizes the content of each chapter in this book.
Chapter 1 Diffuse Shading)
Diffuse, that is, Diffuse reflection. It can be imagined that when the sun shines on a rough plane, the plane will reflect light in all directions, and some of the light enters our eyes, so that we can see this plane. A basic diffuse reflection model needs to include the following parts: a reflection color (which can be understood as the color of the plane itself), an ambient color (ambient color, can be understood as the color of the light source), and calculate the light from all the light sources and.
1.1 create a basic Surface Shader
Create a Shader and use Material.
1.2 add Properties to Surface Shader
The first time I explained the Properties block, how to add new property, and how to declare different types of property.
1.3 Use Properties in Surface Shader
The first time I explained how to create links to various variables in the CGPROGRAM and Properties blocks.
1.4 create a custom diffuse reflection model.
How to use non-default illumination functions in Surface Shader, several categories of illumination functions, basic diffuse reflection illumination model (lanbert illumination model ).
1.5 create a half-lanbert Illumination Model
Half lanbert sounds very high. In fact, it is to increase the brightness of the backlight, so that the illumination range is mapped from (0.0, 1.0) to (0.5, 1.0 ).
1.6 create a gradient texture to control the diffuse reflection coloring
Using a one-dimensional gradient texture to control illumination (that is, the light color is a certain pixel in the texture after sampling) is a very common method, which is very common in many types of Shader, such as cartoon-style Shader. This method has very good variability.
1.7 use a two-dimensional gradient texture to forge a bidirectional reflection Distribution Function
This section describes the integration and expansion of the preceding two sections. Bidirectional, that is, two directions. One refers to the direction of the incident light and the other refers to the direction of the observation point. The previous illumination models only use the first direction, that is, the direction of the incident light. The correction results and similarities and differences between the two directions are given by max and semi-lanbert.
To be continued...
Robocraft: \ Steam \ SteamApps \ common \ Robocraft \ assetbundles \ allshadersunity3d why
Allshaders. unity3d
Delete this file and update the game again.