UNITY SHADER入门精要_学习笔记

UNITY SHADER入门精要 看了将近三个月,虽然去年因为有点事情暂停了看书计划,今年在业余时间一直看,终于看完了。大致了解了shader的渲染,但是写shader还是。。。。。。需要多看大佬的shader代码,学习更多的书籍。

 

ch2_0.渲染流水线:

应用阶段->几何阶段->光栅化阶段

应用阶段:输出渲染图元

几何阶段:处理所有和我们要绘制的几何相关的事情, 将顶点坐标变换到屏幕坐标

光栅化阶段:决定每个渲染图元中的那些像素要绘制在屏幕上

 

 

ch2_1.注意OpenGL和DirectX的坐标轴:

ch3_0.部分专业名词介绍

#pragma surface surfaceFunction lightModel[optionalparams]

声称着色器 表面着色器 着色器代码名称 光照模型

It uses #pragma surface ... directive to indicate it’s a surface shader.

eg:#pragma surface surf Standard fullforwardshadows

 

介绍lightModel

1)Standard:

This lighting model uses SurfaceOutputStandard output struct,

and matches the Standard (metallic workflow) shader in Unity.

 

2)Standard:

This Specular lighting model uses SurfaceOutputStandardSpecular output struct,

and matches the Standard (specular setup) shader in Unity.

 

3).Lambert and BlinnPhong:郎伯模型

This lighting models are not physically based (coming from Unity 4.x),

but the shaders using them can be faster to render on low-end hardware.

 

3.Unity shader类型

1)Standard Surface Shader:标准光照模型

2)Standard Surface Shader(instanced)

3)Unlit Shader:不包含光照,包含雾效

4)Image Effect Shader:实现屏幕后处理效果

5)Compute Shader:产生一个特殊的shader文件,目的是利用cpu的并行性进行一些与常规渲染流水线无关·

 

ch3_1.Unity Shader语法

 

查API:https://docs.unity3d.com/Manual/SL-CullAndDepth.html

SubShader{

Tags {}

Log 200

Pass{

 

.........

Cull off

.......

}

 

 

 

UsePass :Pass的名字时候一定要大写,

ch3_1.自定义材质编辑界面:https://docs.unity3d.com/Manual/SL-CustomShaderGUI.html

 

ch4_0.unity内置的变化矩阵:

举例:把顶点从观察空间变换到模型空间

ch4_1.摄像机和屏幕参数

ch4_2.CG是行优先,一行一行的填充矩阵。Unity Shader使用的是行类型,但是有一种矩阵类型Matrix4x4是列优先。

  • 0
    点赞
  • 7
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值