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. python cookbook第三版学习笔记三:列表以及字符串

    过滤序列元素: 有一个序列,想从其中过滤出想要的元素.最常用的办法就是列表过滤:比如下面的形式:这个表达式的意义是从1000个随机数中选出大于400的数据 test=[] for i in range ...

  2. 基础 PHP 语法

    PHP 脚本在服务器上执行,然后向浏览器发送回纯 HTML 结果. 基础 PHP 语法 PHP 脚本可放置于文档中的任何位置. PHP 脚本以 <?php 开头,以 ?> 结尾: < ...

  3. C++中输出 位宽和小数点后位数 的控制

    要用到这个头文件: <iomanip> setw(x) : 表示控制输出x的位宽 setprecision(x) :表示 控制输出小数点后 x 位 cout.precision(x): 表 ...

  4. UEditor上传文件的默认地址修改

    using System;using System.Collections.Generic;using System.IO;using System.Linq;using System.Text.Re ...

  5. 4.7 希尔(shell)排序法

    4-7 ShellSort.c #include <stdio.h> #include "4-1 CreateData.c" //生成随机数的函数 #define AR ...

  6. html5--1.8超链接下

    html5--1.8超链接下 下面演示链接打开新网友不关闭原网页. 外部网站: 百度 这是用a标签的target属性实现的,用的target="_blank" 这样新出现的页面会另 ...

  7. 实现远程连接MySQL

    首先登录远程服务器,然后登录mysql:mysql -u用户 -p密码; 创建允许远程登录的用户并赋权:grant all privileges on 数据库.表名 to 用户名@'IP地址' ide ...

  8. druid相关的时间序列数据库——也用到了倒排相关的优化技术

    Cattell [6] maintains a great summary about existing Scalable SQL and NoSQL data stores. Hu [18] con ...

  9. yii2 linux安装教程

    安装扩展 安装Yii最好的方式就是使用Composer安装,所以我们需要安装Composer,但是为了安装Composer,我们需要安装一下关于Composer和Yii2的许多扩展包,别担心下面的教程 ...

  10. CentOS 6以下版本 支持Ext4

    CentOS默认是不支持Ext4.所以你需要处理一下才行. 使用环境使用的是CentOS5.8 内核是  2.6.18-238.19.1.el5 其实CentOS 5.8 里面是有 ext4 模块的, ...