让Surface Shader不受光照的明暗影响
直接上码
Shader "Custom/3DVideo" {
Properties {
_Color ("Color", Color) = (,,,)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(,)) = 0.5
_Metallic ("Metallic", Range(,)) = 0.0
_x("x", Range(0.1, )) =
_y("y", Range(0.1, )) =
}
SubShader {
Tags { "RenderType"="Opaque" }
LOD
Cull Front
Lighting Off
CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
// #pragma surface surf Standard fullforwardshadows
#pragma surface surf Unlit noambient
// Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0
half4 LightingUnlit (SurfaceOutput s, half3 lightDir, half atten) {
return fixed4(s.Albedo, s.Alpha);
}
sampler2D _MainTex;
float _x;
float _y;
struct Input {
float2 uv_MainTex;
};
half _Glossiness;
half _Metallic;
fixed4 _Color;
// Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
// See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
// #pragma instancing_options assumeuniformscaling
UNITY_INSTANCING_BUFFER_START(Props)
// put more per-instance properties here
UNITY_INSTANCING_BUFFER_END(Props)
// void surf (Input IN, inout SurfaceOutputStandard o) {
void surf (Input IN, inout SurfaceOutput o) {
float2 uv_XY = IN.uv_MainTex;
float2 uv_MainTex2 = float2(uv_XY.x * _x, uv_XY.y * _y);
// Albedo comes from a texture tinted by color
fixed4 c = tex2D (_MainTex, uv_MainTex2) * _Color;
o.Albedo = c.rgb;
// Metallic and smoothness come from slider variables
// o.Metallic = _Metallic;
// o.Smoothness = _Glossiness;
o.Alpha = c.a;
}
ENDCG
}
FallBack "Diffuse"
}
让Surface Shader不受光照的明暗影响的更多相关文章
- Surface Shader简单向导
Surface Shader 表面着色器 描述 当你的Material要处理光照,则一般使用Surface Shader.Surface Shader隐藏了光照的计算,你只需要在surf函数里设置好反 ...
- Surface Shader
Surface Shader: (1)必须放在SubShdader块,不能放在Pass内部: (2)#pragma sufrace surfaceFunction lightModel [option ...
- 【Unity Shaders】初探Surface Shader背后的机制
转载请注明出处:http://blog.csdn.net/candycat1992/article/details/39994049 写在前面 一直以来,Unity Surface Shader背后的 ...
- 【Unity Shaders】Shader中的光照
写在前面 自己写过Vertex & Fragment Shader的童鞋,大概都会对Unity的光照痛恨不已.当然,我相信这是因为我们写得少...不过这也是由于官方文档对这方面介绍很少的缘故, ...
- 【Unity Shaders】Shader学习资源和Surface Shader概述
写在前面 写这篇文章的时候,我断断续续学习Unity Shader半年了,其实还是个门外汉.我也能体会很多童鞋那种想要学好Shader却无从下手的感觉.在这个期间,我找到一些学习Shader的教程以及 ...
- Unity Shader (三)Surface Shader机制
转自:http://blog.csdn.net/candycat1992/article/details/39994049 写在前面 一直以来,Unity Surface Shader背后的机制一直是 ...
- Unity Shader——Writing Surface Shaders(3)——Surface Shader Lighting Examples
Surface Shader 光照例子 这里有一些自定义光照模型和Surface Shaders的例子.通常的Surface Shader例子在这里. 由于延迟光照在某些自定义的逐材质光照模型中表现得 ...
- Unity Shader——Writing Surface Shaders(1)——Surface Shader Examples
这里有Surface Shader的一些例子.下面的这些例子关注使用内建的光照模型:关于如何使用自定义光照模型的例子参见Surface Shader Lighting Examples. 简单 我们将 ...
- unity, unlit surface shader (texColor only surface shader)
要实现双面透明无光照只有纹理色的surface shader. 错误的写法:(导致带有曝光) Shader "Custom/doubleFaceTranspTexColor" { ...
随机推荐
- postgresql开篇
postgresql 作为官方号称的最先进的开源数据库,从今天(2020-1-19)起开始系统的学习一下,记录自己学习的点点滴滴.
- minio gateway 代理s3 存储
以前有写过使用minio gataway 代理nas 的,实际上还可以代理s3 ,hdfs....,以下是一个gatway 带来nas 以及s3 集成的模式 环境准备 docker-compose文件 ...
- C#开发OPC客户端
第一个随笔,使用了OPEN Live Write,作为客户端.最近使用c#开发一个小软件,主要功能是OPC客户端.以后会开发各类别的协议,作为,协议的转发栈. 因为我本人是搞自动化的,所以搞自动化小伙 ...
- css基础-定位+网页布局案例
position:static 忽略top/bottom/left/right或者z-index position:relative 设置相对定位的元素不会脱离文档流 position:fixed 不 ...
- idea中创建maven的Javaweb工程并进行配置
学完maven后,可以创建maven的javaweb工程,在创建完成后还需要一些配置,下面来说下具体步骤,在这里我创建的是一个模块,创建web项目的方式和创建模块一样 1.创建一个模块,点new-Mo ...
- Win10查看屏保的所在位置
路径 C:\Users\Hlzy\AppData\Local\Packages\Microsoft.Windows.ContentDeliveryManager_cw5n1h2txyewy\Local ...
- 剑指offer-拓展训练-N皇后的问题-全排列
/* 题目: N皇后的问题. */ /* 思路: 全排列. 声明一个具有N个元素的数组curr,每个下标i(0>i>n)代表行,每个curr[i]代表列,所以初始化为curr[i] = i ...
- [开发技巧]·AttributeError: module 'pywt' has no attribute 'wavedec'解决方法
[开发技巧]·AttributeError: module 'pywt' has no attribute 'wavedec'解决方法 1.卸载 pywt pip uninstall pywt 2.安 ...
- 嵊州D2T4 十七个中毒的英国人 poisoning
嵊州D2T4 十七个中毒的英国人 poisoning 利内罗女士准备来到意大利进行修行. 意大利由 n 个城市和 m 条道路构成,道路是双向的. 到达第 i 个城市时,她可以取得该城市的全部信仰,并获 ...
- tcp_demo
代码讲解: server import socket def main(): # 创建tcp服务器套接字 tcp_server = socket.socket(socket.AF_INET, sock ...