https://docs.unity3d.com/Manual/SL-SurfaceShaderLighting.html

Lighting Model declaration

Lighting model is a couple of regular functions with names starting with Lighting. They can be declared anywhere in your shader file or one of included files. The functions
are:

  1. half4 Lighting<Name> (SurfaceOutput s, UnityGI gi); This is used inforward rendering
    path for light models that are not view direction dependent (e.g. diffuse).

  2. half4 Lighting<Name> (SurfaceOutput s, half3 viewDir, UnityGI gi); This is used inforward
    rendering
    path for light models that are view direction dependent.

  3. half4 Lighting<Name>_Deferred(SurfaceOutput s, UnityGI gi, out half4 outDiffuseOcclusion,
    out half4 outSpecSmoothness, out half4 outNormal);
     This isused in deferred lighting path.

  4. half4 Lighting<Name>_PrePass (SurfaceOutput s, half4 light); This
    is used in light prepass (legacy deferred) lighting path.

Note that you don’t need to declare all functions. A lighting model either uses view direction or it does not. Similarly, if the lighting model only works in forward, do not declare the _Deferred or _Prepass function.
This way, all Shaders that use it compile to forward rendering only.

渲染路径-surface shader 光照函数与渲染路径的更多相关文章

  1. Unity Shader——Writing Surface Shaders(3)——Surface Shader Lighting Examples

    Surface Shader 光照例子 这里有一些自定义光照模型和Surface Shaders的例子.通常的Surface Shader例子在这里. 由于延迟光照在某些自定义的逐材质光照模型中表现得 ...

  2. 小强学渲染之Unity Shader编程HelloWorld

    第一个简单的顶点vert/片元frag着色器   1)打开Unity 5.6编辑器,新建一个场景后ctrl+s保存命名为Scene_5.默认创建的场景是包含了一摄像机,一平行光,且场景背景是一天空盒而 ...

  3. Unity3D -- shader光照常用函数和变量

    上一篇记录了shader常用函数和变量,这篇记录一些光照计算时常用函数和变量 1.内置的光照变量 _LightColor0 float4 //该Pass处理的逐像素光源的颜色 _WorldSpaceL ...

  4. Android系统Surface机制的SurfaceFlinger服务渲染应用程序UI的过程分析

    参考:Android系统Surface机制的SurfaceFlinger服务渲染应用程序UI的过程分析 一句话概括一下Android应用程序显示的过程:Android应用程序调用SurfaceFlin ...

  5. Unity5 新功能解析--物理渲染与standard shader

    Unity5 新功能解析--物理渲染与standard shader http://blog.csdn.net/leonwei/article/details/48395061 物理渲染是UNITY5 ...

  6. android Shader类简介_渲染图像示例

    Android中提供了Shader类专门用来渲染图像以及一些几何图形,Shader下面包括几个直接子类,分别是BitmapShader. ComposeShader.LinearGradient.Ra ...

  7. Surface Shader简单向导

    Surface Shader 表面着色器 描述 当你的Material要处理光照,则一般使用Surface Shader.Surface Shader隐藏了光照的计算,你只需要在surf函数里设置好反 ...

  8. Unity Shader——Writing Surface Shaders(1)——Surface Shader Examples

    这里有Surface Shader的一些例子.下面的这些例子关注使用内建的光照模型:关于如何使用自定义光照模型的例子参见Surface Shader Lighting Examples. 简单 我们将 ...

  9. Surface Shader

    Surface Shader: (1)必须放在SubShdader块,不能放在Pass内部: (2)#pragma sufrace surfaceFunction lightModel [option ...

随机推荐

  1. (转)php 根据url自动生成缩略图并处理高并发问题

    分享是一种精神,与技术高低无关!   图片缩略图动态生成- [代码编程] 2011-08-23 版权声明:转载时请以超链接形式标明文章原始出处和作者信息及本声明http://www.blogbus.c ...

  2. Unix和Linux历史文化

    1.显示工作目录pwd   print working directory     print name of current/working directory 2.显示自己终端名称tty   pr ...

  3. Java for LeetCode 118 Pascal's Triangle

    Given numRows, generate the first numRows of Pascal's triangle. For example, given numRows = 5, Retu ...

  4. SSH Tunnel扫盲(ssh port forwarding端口转发)

    SSH的的Port Forward,中文可以称为端口转发,是SSH的一项非常重要的功能.它可以建立一条安全的SSH通道,并把任意的TCP连接放到这条通道中.下面仔细就仔细讨论SSH的这种非常有用的功能 ...

  5. jQuery 网页禁止复制

    <script type="text/javascript">    $(document).ready(function(){         $('#文本框id') ...

  6. easyui datagrid行合并

    easyui datagrid行合并 合并方法 /** * EasyUI DataGrid根据字段动态合并单元格 * 参数 tableID 要合并table的id * 参数 colList 要合并的列 ...

  7. System.Configuration.ConfigurationErrorsException: An error occurred creating the configuration sect

    An error has occurred creating the configuration section handler for userSettings/Microsoft.SqlServe ...

  8. mooc_java 集合框架上 学生所选课程

    用一个集合Set存放学生所选课程接口不能实例化,所以用其实现类进行实例化 set接口不能实例化,通过HashSet这个实现类来进行实例化,需要导入包this.courses=new HashSet() ...

  9. 织梦简洁机械设备dedecms模板

    织梦简洁机械设备dedecms模板,个人网站模板,dedecms模板. 模板地址:http://www.huiyi8.com/sc/7269.html

  10. Android窗口系统第一篇---Window的类型与Z-Order确定

    Android的窗口系统是UI架构很重要的一部分,数据结构比较多,细节比较多.本篇文章主要介绍窗口相关数据结构和抽象概念理解,关于[窗口部分的博客]计划如下. 1.窗口Z-Order的管理 2.应用程 ...