让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" { ...
随机推荐
- MySQL数据库root密码忘记丢失重置方法
对于DBA来说,丢失超管用户root的密码是致命的, 可以通过添加--ship-grant-tables参数来跳过权限表. 1.忘记root密码,进不去数据库: 这个时候需要强制停库,先查看MySQL ...
- mysql 查询出现 "this is incompatible with sql_mode=only_full_group_by"错误解决方案,以及个人rpm方式重装所遇到的问题备份
一.错误说明 这个错误发生在mysql 5.7 版本及以上版本会出现的问题: mysql .7版本默认的sql配置是:sql_mode="ONLY_FULL_GR ...
- Centos7 防火墙开放端口,查看状态,查看开放端口
CentOS7 端口的开放关闭查看都是用防火墙来控制的,具体命令如下: 查看防火墙状态:(active (running) 即是开启状态) [root@WSS bin]# systemctl fire ...
- 纪中某日c组模拟赛 2314. 最短路
2314. 最短路 (File IO): input:dti.in output:dti.out 时间限制: 1000 ms 空间限制: 262144 KB 具体限制 Goto Problem ...
- 就不能换DB吗? 抽象工厂模式
15.1 就不能换DB吗? 15.2 最基本的数据访问程序 namespace 抽象工厂模式 { class Program { static void Main(string[] args) { U ...
- Python 静态类型检查 mypy 示例
以下所有例子都参考了最新版本的 Python 文档与 mypy 文档 必备条件 安装最新版本的 Python 和 mypy 要学会按需配置自己的编辑器,比如我的 VSCode 就装好了 Python ...
- Python之lambda表达式的妙用
用法 Python的lambda表达式用于构建匿名函数,基本语法是在冒号左边放原函数的参数,可以有多个参数,用逗号隔开即可:冒号右边是返回值. >>> lambda x,y: (x+ ...
- day9 修改文件
# 修改文件 # 文件是不能修改 with open('小护士班主任', mode='r', encoding='utf-') as f, open('小护士班主任.bak', 'w', encodi ...
- 剑指offer-面试题53_3-数组中数值和下标相等的元素-二分查找
/* 题目: 求单调递增数组中,数值与下标相等的任意数字. */ /* 思路: 二分法. */ #include<iostream> #include<cstring> #in ...
- 阿里云搭建k8s高可用集群(1.17.3)
首先准备5台centos7 ecs实例最低要求2c4G 开启SLB(私网) 这里我们采用堆叠拓扑的方式构建高可用集群,因为k8s 集群etcd采用了raft算法保证集群一致性,所以高可用必须保证至少3 ...