Color, Material, Lighting
【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
}
}
}
}
Color, Material, Lighting的更多相关文章
- Unity3d Shader开发(三)Pass(Color, Material, Lighting )
材质和灯光参数被用于控制内置顶点光照.顶点光照是Direct3D/OpenGL标准的按每顶点计算的光照模型.光照打开时,光照受材质块,颜色材质和平行高光命令的影响. 每像素光照常被实现为自定义顶点/片 ...
- 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(' ...
- Unity3d 着色器语法(Shader)
Shader "name" { [Properties] Subshaders [Fallback] } 定义了一个着色器.着色器拥有一个 Properties 的列表.着色器包含 ...
- Unity3d Shader
Unity3d Shader 预览Surface Shader主要用来实现光照相关处理,可能更简洁. Vertex and Fragment Shader 如果不与光照交互, 则可以用这个shader ...
- Vertex and FragmentShader顶点与片段着色器
一.顶点与片段着色器简介 Vertex and FragmentShader:最强大的Shader类型,也是本系列的重点,下文中简称V&FShader,属于可编程渲染管线.使用的是CG/HLS ...
- U3D shaderlab 相关指令开关
Subshader { [Tags] [CommonState] Passdef [Passdef ...] }Tags分为SubShader Tags和Pass Tags,Tags放在SubShad ...
- Cesium原理篇:Material
Shader 首先,在本文开始前,我们先普及一下材质的概念,这里推荐材质,普及材质的内容都是截取自该网站,我觉得他写的已经够好了.在开始普及概念前,推荐一首我此刻想到的歌<光---陈粒>. ...
- Cesium原理篇:Material【转】
https://www.cnblogs.com/fuckgiser/p/6171245.html Shader 首先,在本文开始前,我们先普及一下材质的概念,这里推荐材质,普及材质的内容都是截取自该网 ...
- Material Design Lite,简洁惊艳的前端工具箱。
本文版权归作者和博客园共有,欢迎转载,但未经作者同意必须保留此段声明,且在文章页面明显位置给出原文连接,博客地址为http://www.cnblogs.com/jasonnode/ .网站上有对应每一 ...
随机推荐
- 记录一些WPF常用样式方便以后复用(二)(Button、CheckBox、输入账号密码框)(转)
Button (一) <Style x:Key="ButtonSaveStyle" TargetType="{x:Type Button}"> &l ...
- filter添加水印
1filter写法 先定义自己的responseWrapper chain.doFilter(request,responseWrapper); responseWrapper来输出 package ...
- filter异常捕捉
jsp中抛出一个异常 <% String action = request.getParameter("action"); if ("accountExceptio ...
- Codeforces Round #204 (Div. 2) C. Jeff and Rounding——数学规律
给予N*2个数字,改变其中的N个向上进位,N个向下进位,使最后得到得数与原来数的差的绝对值最小 考虑小数点后面的数字,如果这些数都非零,则就是 abs(原数小数部分相加-1*n), 多一个0 则 m ...
- Go的List操作上的一个小“坑”
转自http://sharecore.net/blog/2014/01/09/the-trap-in-golang-list/ 一直想不清楚一个问题,简单设计的东西到底是“坑多”还是“坑少”呢? 复杂 ...
- Juicer自定义函数
首先,先写自定义的方法: function (sex) { ; ; var Range = Max - Min; var Rand = Math.random(); var res = (Min + ...
- APP推送通知相关实现
关于推送通知,iOS推送主要是通过服务端来实现的,相关过程可以参考下面两篇文章: http://cshbbrain.iteye.com/blog/1859810 http://zxs198 ...
- 004:MySQL数据库体系结构
目录 一. MySQL数据库体系结构 1.MySQL数据库体系结构介绍 1 数据库定义 2 数据库实例 2. MySQL体系结构 1 单进程多线程结构 2 存储引擎的概念 3 体系结构图 4 逻辑存储 ...
- 文档主题生成模型(LDA)
一.问题描述 1.1文本建模相关 统计文本建模的目的其实很简单:就是估算一组参数,这组参数使得整个语料库出现的概率最大.这是很简单的极大似然的思想了,就是认为观测到的样本的概率是最大的.建模的目标也是 ...
- 超简单让ubuntu开启wifi热点(亲测16.04与14.04可用)
今天教大家一个简单方法让ubuntu发散wifi热点给手机或者其他设备使用. 首先,创建一个普通的热点,点击右上角的网络,然后选择下拉菜单中的编辑连接,然后出现以下界面. 然后点击增加,连接类型选接W ...