当前位置:网站首页>Getting started with UnityShader (3) - Unity's Shader
Getting started with UnityShader (3) - Unity's Shader
2022-07-31 14:28:00 【Tomato Ape】
1 Unity Shader介绍
1.1 Unity Shader的基础:ShaderLab
1.2 Unity Shader属性块
Shader ""
{
Properties
{
_Int("Int", Int) = 2
_Float("Float", float) = 1.5
_Range("Range", range(0.0, 2.0)) = 1.0
_Color("Color", Color) = (1, 1, 1, 1)
_Vector("Vector", Vector) = (1, 4, 3, 8)
_MainTex("Texture", 2D) = "white"{
}
_3D("3D", 3D) = "black"{
}
}
}
1.3 Unity Shader SubShader
Tags
Tags可以写在SubShader的一开始(所有的Pass用),也可以写在Pass块的内部(该Pass用)
渲染设置
同TagsThe same can also be written in Pass中或者写在Pass外面(SubShader一开始)
Pass介绍
Pass里面可以定义Pass名称
Pass里面的TagsThere can also be additional settings
还有CG语言所写的代码,Mainly vertex fragment shaders,Use the following keywords to wrap
CGPROGRAM
ENDCG
FallBack
2 SurfaceShader介绍
SurfaceShaderactually at the vertex、On the basis of the fragment shader, another layer of encapsulation is carried out,我们可以通过Show GenerateCode来查看到.(We can see the compiled vertices、Fragment shaders are very complex)
SurfaceShaderThe structure and front vertices、The structure of the fragment shader is the same.主要区别在于SubShader中.
3 UnityShader != 真正的Shader
Unity Shader实际上指的就是一个ShaderLab文件.以.shaderA file as a suffix.在Unity shader里面,我们可以做的事情远多于一个传统意义上的Shader.
在传统的shader中,我们仅可以编写特定类型的Shader,例如顶点着色器,片元着色器等.在Unity Shader中,We can include both vertex shader and fragment shader code needed in the same file.
在传统shader中,我们无法设置一些渲染设置,例如是否开启混合,深度测试等,These are set by developers themselves in additional code.而Unity shader中,We can complete these settings with a single line of specific instructions.
在传统shader中,We need to write lengthy code to set up the input and output of the shader,Be careful to deal with the positional correspondence of these inputs and outputs, etc.而在Unity shader中,We just need to declare some properties in a specific block of statements,You can easily change these properties by relying on materials.And for the data that comes with the model(如顶点,纹理坐标,法线等),Unity Shader也提供了直接访问的方法,No developer coding is required to pass to the shader.
边栏推荐
- Miller_Rabin Miller Rabin probability sieve [template]
- Unity Shader入门精要学习——透明效果
- 网线RJ45接口针脚[通俗易懂]
- 使用NVM进行node版本切换管理
- 1小时直播招募令:行业大咖干货分享,企业报名开启丨量子位·视点
- Selenium自动化测试之Selenium IDE
- NPM Taobao mirror (latest version) released a new version of npm mirror at 2021-11-21 16:53:52 [easy to understand]
- The JVM a class loader
- Prometheus之node_exporter性能监控信息采集含义
- Recommendation System - Recall Phase - 2013: DSSM (Twin Towers Model) [Embedding (Semantic Vector) Recall] [Microsoft]
猜你喜欢
sentinel与nacos持久化
How to grab configuration information for DELL SC compellent storage system
232层3D闪存芯片来了:单片容量2TB,传输速度提高50%
SetoolKit使用指南
Analysis of the startup source code of hyperf (2) - how the request reaches the controller
The Selenium IDE of the Selenium test automation
使用CompletableFuture进行异步处理业务
SetoolKit User Guide
Sentinel流量控制
OAuth2:使用JWT令牌
随机推荐
ERROR: Failed building wheel for osgeo
对数字化时代的企业来说,数据治理难做,但应该去做
【redis】发布和订阅消息
推荐系统-召回阶段-2013:DSSM(双塔模型)【Embedding(语义向量)召回】【微软】
Unity Shader入门精要学习——透明效果
AWS implements scheduled tasks - Lambda+EventBridge
常用工具命令速查表
MySQL [aggregate function]
C# using ComboBox control
Shell script classic case: backup of files
OAuth2:单点登陆客户端
C language basic practice (nine-nine multiplication table) and printing different asterisk patterns
高等数学——常用不定积分公式
2021 OWASP TOP 10 Vulnerability Guide
纸质说明书秒变3D动画,斯坦福大学吴佳俊最新研究,入选ECCV 2022
charles进行弱网测试(app弱网测试怎么做)
MySQL has played to such a degree, no wonder the big manufacturers are rushing to ask for it!
小试牛刀:Go 反射帮我把 Excel 转成 Struct
The Selenium IDE of the Selenium test automation
Unity study notes Description of AVPro video jump function (Seeking)