Color, Material, Lighting

  The material and lighting parameters are used to control the built-in vertex lighting. Vertex lighting is the standard Direct3D/OpenGL lighting model that is computed for each vertex.

  material & parameters 参数用于控制vertex lighting。

   Lighting on turns it on. Lighting is affected by Material block, ColorMaterial and SeparateSpecular commands.

  Lighting on 命令开启顶点光照。Lighting受Material、ColorMaterial、SeparateSpecular命令的影响。

  Per-pixel lights are usually implemented with custom vertex/fragment programs and don't use vertex lighting. For these you don't use any of the commands described here, instead you define your own vertex and fragment programs where you do all lighting, texturing and anything else yourself.

  Per-pixel 光照通过通过vertex/fragment 程序来实现,它们不使用顶点光照。Per-pixel光照不使用上述的任何命令,你需要定义自己的vertex & fragment 程序,在那里你要做lighting、texturing等所有的事。

  

[Syntax]

  Color:ColorSets the object to a solid color. A color is either four RGBA values in parenthesis, or a color property name in square brackets.

  Material:{ Material Block }The Material block is used to define the material properties of the object.

  Lighting:On | Off。For the settings defined in the Material block to have any effect, you must enable Lighting with the Lighting On command. If lighting is off instead, the color is taken straight from the Color command.

  SeparateSpecular:On | Off。 This command makes specular lighting be added to the end of the shader pass, so specular lighting is unaffected by texturing. Only has effect when Lighting On is used.

[Material Block]

  This contains settings for how the material reacts to the light. Any of these properties can be left out, in which case they default to black (i.e. have no effect).

  Diffuse:ColorThe diffuse color component. This is an object's base color.

  Ambient:ColorThe ambient color component. This is the color the object has when it's hit by the ambient light set in the RenderSettings.

  Specular:ColorThe color of the object's specular highlight.

  Shininess:NumberThe sharpness of the highlight, between 0 and 1. At 0 you get a huge highlight that looks a lot like diffuse lighting, at 1 you get a tiny speck.

  Emission:ColorThe color of the object when it is not hit by any light.

  The full color of lights hitting the object is:

  

  The light parts of the equation (within parenthesis) is repeated for all lights that hit the object.

[Examples]

1、Always render object in pure red:

Shader "Solid Red" {
SubShader {
Pass { Color (,,,) }
}
}

2、Basic Shader that colors the object white and applies vertex lighting:

Shader "VertexLit White" {
SubShader {
Pass {
Material {
Diffuse (,,,)
Ambient (,,,)
}
Lighting On
}
}
}

3、An extended version that adds material color as a property visible in Material Inspector:

Shader "VertexLit Simple" {
Properties {
_Color ("Main Color", COLOR) = (,,,)
}
SubShader {
Pass {
Material {
Diffuse [_Color]
Ambient [_Color]
}
Lighting On
}
}
}

4、And finally, a full fledged vertex-lit shader (see also SetTexture reference page):

Shader "VertexLit" {
Properties {
_Color ("Main Color", Color) = (,,,)
_SpecColor ("Spec Color", Color) = (,,,)
_Emission ("Emmisive Color", Color) = (,,,)
_Shininess ("Shininess", Range (0.01, )) = 0.7
_MainTex ("Base (RGB)", 2D) = "white" {}
}
SubShader {
Pass {
Material {
Diffuse [_Color]
Ambient [_Color]
Shininess [_Shininess]
Specular [_SpecColor]
Emission [_Emission]
}
Lighting On
SeparateSpecular On
SetTexture [_MainTex] {
Combine texture * primary DOUBLE, texture * primary
}
}
}
}

参考:file://localhost/Applications/Unity/Unity.app/Contents/Documentation/Documentation/Components/SL-Material.html

  

Color, Material, Lighting的更多相关文章

  1. Unity3d Shader开发(三)Pass(Color, Material, Lighting )

    材质和灯光参数被用于控制内置顶点光照.顶点光照是Direct3D/OpenGL标准的按每顶点计算的光照模型.光照打开时,光照受材质块,颜色材质和平行高光命令的影响. 每像素光照常被实现为自定义顶点/片 ...

  2. MATLAB light material lighting

    clf;[X,Y,Z]=sphere(40);colormap(jet)subplot(1,2,1),surf(X,Y,Z),axis off square,shading interplight(' ...

  3. Unity3d 着色器语法(Shader)

    Shader "name" { [Properties] Subshaders [Fallback] } 定义了一个着色器.着色器拥有一个 Properties 的列表.着色器包含 ...

  4. Unity3d Shader

    Unity3d Shader 预览Surface Shader主要用来实现光照相关处理,可能更简洁. Vertex and Fragment Shader 如果不与光照交互, 则可以用这个shader ...

  5. Vertex and FragmentShader顶点与片段着色器

    一.顶点与片段着色器简介 Vertex and FragmentShader:最强大的Shader类型,也是本系列的重点,下文中简称V&FShader,属于可编程渲染管线.使用的是CG/HLS ...

  6. U3D shaderlab 相关指令开关

    Subshader { [Tags] [CommonState] Passdef [Passdef ...] }Tags分为SubShader Tags和Pass Tags,Tags放在SubShad ...

  7. Cesium原理篇:Material

    Shader 首先,在本文开始前,我们先普及一下材质的概念,这里推荐材质,普及材质的内容都是截取自该网站,我觉得他写的已经够好了.在开始普及概念前,推荐一首我此刻想到的歌<光---陈粒>. ...

  8. Cesium原理篇:Material【转】

    https://www.cnblogs.com/fuckgiser/p/6171245.html Shader 首先,在本文开始前,我们先普及一下材质的概念,这里推荐材质,普及材质的内容都是截取自该网 ...

  9. Material Design Lite,简洁惊艳的前端工具箱。

    本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,博客地址为http://www.cnblogs.com/jasonnode/ .网站上有对应每一 ...

随机推荐

  1. elixir 使用mix umbrella 模块化项目

    备注: 项目比较大, 模块比较多,一般使用mix 的方式是大家进行文件夹的划分,但是使用mix 的umbrella 可能会更方便 1. 安装 默认安装elixir 的时候已经包含了这个功能 2. 基本 ...

  2. arangodb 安装简单试用

    备注:   测试环境使用的是docker  1. 安装 docker run -p 8529:8529 -e ARANGO_ROOT_PASSWORD=openSesame arangodb/aran ...

  3. (高级篇)jQuery学习之jQuery Ajax用法详解

    jQuery Ajax在web应用开发中很常用,它主要包括有ajax,get,post,load,getscript等等这几种常用无刷新操作方法,下面我来给各位同学介绍介绍. 我们先从最简单的方法看起 ...

  4. Netty--TCP粘包和拆包

    TCP协议以流的方式进行数据传输,它无法理解其上层协议的数据意义,而是根据TCP缓冲区的大小对数据进行拆分或组装,即上层一个完整的包可能被拆为几个TCP包来发送,或上层几个包会被组合为一个TCP包发送 ...

  5. flv 解封装

    #include <stdio.h> #include <stdlib.h> #include <string.h> #define DEBUG_INFO type ...

  6. 杂项:大数据 (巨量数据集合(IT行业术语))

    ylbtech-杂项:大数据 (巨量数据集合(IT行业术语)) 大数据(big data),指无法在一定时间范围内用常规软件工具进行捕捉.管理和处理的数据集合,是需要新处理模式才能具有更强的决策力.洞 ...

  7. 2_python之路之多级菜单

    python之路之多级菜单 1.使用知识点 (1)列表,字典的使用 (2)if条件判断语句 (3)for/while循环的使用 2.代码详细 #!/usr/bin/env python # _*_ c ...

  8. Python添加模块

    参考博客:http://blog.csdn.net/damotiansheng/article/details/43916881 http://my.oschina.net/leejun2005/bl ...

  9. ceph---luminous版的安装

    前言 ceph luminous版本新增加了很多有意思的功能,这个也是一个长期支持版本,所以这些新功能的特性还是很值得期待的,从底层的存储改造,消息方式的改变,以及一些之前未实现的功能的完成,都让ce ...

  10. 第二章:Android Studio概述(二)[学习Android Studio汉化教程]

    The Main Menu Bar 主菜单栏  主菜单栏位于Android Studio的最上面,你几乎可以利用主菜单和其子菜单来执行任何操作.不像Android Studio中其他的一些菜单,主菜单 ...