当前位置:网站首页>《UnityShader入门精要》总结(2):初级篇
《UnityShader入门精要》总结(2):初级篇
2022-07-29 09:18:00 【饿掉鱼】
紫色:大类概念或简短有力的总结
蓝色:细分概念或重要部分
红色:重要的补充注释
第五章:认识UnityShader
从一个最简单的着色器结构说起

一个包含了顶点着色器和片元着色器的基本代码
#pragma 定义了着色器类型
vertex为顶点,fragment为片元 (shader使用的是CG语法)

其中的Fixed4,float4等都代表了什么?

看一个进阶版的将顶点和片元着色器联动的代码

如果觉得比较绕.可以暂时将冒号当做"来自于"理解
float4 vertex : POSITION
比如创建了一个float4变量vertex,其来自于POSITION(模型空间顶点坐标)
这次vert返回了一个v2f结构而非float4了.并且最后frag也成功引用了v2f完成着色
(vertex.normal是法线)


调用属性
属性就是在编辑器界面可更改的变量。使用Properties

直接在着色器中引用

这样,一个颜色可随时调节的shader就做好了

边栏推荐
- 文件重命名后,怎样将新旧文件名及所在位置导出到excel
- Travel notes in 2022 (ongoing)
- Parameter initialization
- Asp graduation project - based on C # +asp Net+sqlserver laboratory reservation system design and Implementation (graduation thesis + program source code) - Laboratory Reservation System
- 原型链继承和构造函数继承的 “毛病”
- Retinal Vessel Segmentation via a Semantics and Multi-Scale Aggregation Network
- Error reporting when adding fields to sap se11 transparent table: structural changes at the field level (conversion table xxxxx)
- Amazfit dial toolbox Online
- 2022危险化学品经营单位主要负责人操作证考试题库及答案
- 网络原理笔记(五层网络)
猜你喜欢

【BERT-多标签文本分类实战】之一——实战项目总览

One click automated data analysis! Come and have a look at these treasure tool libraries

2022 question bank and answers of operation certificate examination for main principals of hazardous chemical business units

【机器学习】朴素贝叶斯代码练习

Excellent Allegro skill recommendation

四元数与其在Unity中的简单应用

【Unity入门计划】C#与Unity-了解类和对象

2022电工(初级)考题模拟考试平台操作

CVPR 2022 | clonedperson: building a large-scale virtual pedestrian data set of real wear and wear from a single photo

Axurerp prototype design starts quickly
随机推荐
What should I pay attention to now? Excuse me, is it safe to open a stock account by mobile phone?
(Video + graphic) introduction to machine learning series - Chapter 3 logical regression
[LOJ 6485] LJJ binomial theorem (unit root inversion) (template)
State compression DP
浅谈契约测试
Travel notes in 2022 (ongoing)
Can the access database be accessed remotely
2022危险化学品经营单位主要负责人操作证考试题库及答案
Data representation and calculation (base)
机器学习之分类模型评估指标及sklearn代码实现
Leetcode deduction topic summary (topic No.: 53, 3, 141, interview question 022, the entry node of the link in the sword finger offer chain, 20, 19, Niuke NC1, 103, 1143, Niuke 127)
Collation of ml.net related resources
Compile and install Apache for rocky Foundation
Database system design: partition
Summary of some experiences in the process of R & D platform splitting
How does alternates achieve high-performance publish and subscribe?
I don't know how lucky the boy who randomly typed logs is. There must be a lot of overtime
Mathematical modeling - Differential Equations
Unity3d learning notes (I)
Shutter gradient