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. RANDOM 的用法

    random 用法 1.利用RANDOM取随机数 shell有一个环境变量RANDOM,范围是0--32767 如果我们想要产生0-25范围内的数:$(($RANDOM%26),在$(()) 是可以省 ...

  2. 宿舍更换的新淋浴喷头"水温vs旋钮角度"关系的研究(曲线)

    版权声明:我极少创造新知识,大部分情况下是个知识的二道贩子 https://blog.csdn.net/stereohomology/article/details/24478825 应该非常一目了然 ...

  3. 创建spring管理的自定义注解

    转自: http://blog.csdn.net/wuqiqing_1/article/details/52763372 Annotation其实是一种接口.通过Java的反射机制相关的API来访问A ...

  4. long_query_time 设置不生效问题

    由于原来的慢查询日志太大了,有1G多,并且其中包含上一次查询优化前的慢sql,所以想收集最近两天的慢查询语句,故 mysql> show global variables like 'slow% ...

  5. Java for LeetCode 108 Convert Sorted Array to Binary Search Tree

    Given an array where elements are sorted in ascending order, convert it to a height balanced BST. 解题 ...

  6. Delphi-WebService(53)

    Delphi-WebService(53) http://blog.csdn.net/qq56430204/article/details/4875770 Delphi Web Services程序

  7. 算法(Algorithms)第4版 练习 1.3.25 1.3.24

    代码实现: //1.3.24 /** * remove the node following the node x * (and does nothing if the argument or the ...

  8. KafkaSpout 重复消费问题解决

    使用https://github.com/nathanmarz/storm-contrib来对接Kafka0.7.2时, 发现kafkaSpout总会进行数据重读, 配置都无问题, 也没报错 进行de ...

  9. javascript(6)

    javascript的冒泡排序 var arr=[5,0,-56,900,12]; //大的排序次数(arr.length-1) var flag=false; for(var i=0;i<=a ...

  10. UML中的6大关系详细说明

    UML中的6大关系详细说明: 1.关联关系: 含义:类与类之间的连结,关联关系使一个类知道另外一个类的属性和方法:通常含有“知道”,“了解”的含义 体现:在C#中,关联关系是通过成员变量来实现的: 方 ...