直接上码

  1. Shader "Custom/3DVideo" {
  2. Properties {
  3. _Color ("Color", Color) = (,,,)
  4. _MainTex ("Albedo (RGB)", 2D) = "white" {}
  5. _Glossiness ("Smoothness", Range(,)) = 0.5
  6. _Metallic ("Metallic", Range(,)) = 0.0
  7. _x("x", Range(0.1, )) =
  8. _y("y", Range(0.1, )) =
  9. }
  10. SubShader {
  11. Tags { "RenderType"="Opaque" }
  12. LOD
  13. Cull Front
  14. Lighting Off
  15.  
  16. CGPROGRAM
  17. // Physically based Standard lighting model, and enable shadows on all light types
  18. // #pragma surface surf Standard fullforwardshadows
  19. #pragma surface surf Unlit noambient
  20.  
  21. // Use shader model 3.0 target, to get nicer looking lighting
  22. #pragma target 3.0
  23.  
  24. half4 LightingUnlit (SurfaceOutput s, half3 lightDir, half atten) {
  25. return fixed4(s.Albedo, s.Alpha);
  26. }
  27.  
  28. sampler2D _MainTex;
  29. float _x;
  30. float _y;
  31.  
  32. struct Input {
  33. float2 uv_MainTex;
  34. };
  35.  
  36. half _Glossiness;
  37. half _Metallic;
  38. fixed4 _Color;
  39.  
  40. // Add instancing support for this shader. You need to check 'Enable Instancing' on materials that use the shader.
  41. // See https://docs.unity3d.com/Manual/GPUInstancing.html for more information about instancing.
  42. // #pragma instancing_options assumeuniformscaling
  43. UNITY_INSTANCING_BUFFER_START(Props)
  44. // put more per-instance properties here
  45. UNITY_INSTANCING_BUFFER_END(Props)
  46.  
  47. // void surf (Input IN, inout SurfaceOutputStandard o) {
  48. void surf (Input IN, inout SurfaceOutput o) {
  49. float2 uv_XY = IN.uv_MainTex;
  50. float2 uv_MainTex2 = float2(uv_XY.x * _x, uv_XY.y * _y);
  51. // Albedo comes from a texture tinted by color
  52. fixed4 c = tex2D (_MainTex, uv_MainTex2) * _Color;
  53. o.Albedo = c.rgb;
  54. // Metallic and smoothness come from slider variables
  55. // o.Metallic = _Metallic;
  56. // o.Smoothness = _Glossiness;
  57. o.Alpha = c.a;
  58. }
  59. ENDCG
  60. }
  61. FallBack "Diffuse"
  62. }

让Surface Shader不受光照的明暗影响的更多相关文章

  1. Surface Shader简单向导

    Surface Shader 表面着色器 描述 当你的Material要处理光照,则一般使用Surface Shader.Surface Shader隐藏了光照的计算,你只需要在surf函数里设置好反 ...

  2. Surface Shader

    Surface Shader: (1)必须放在SubShdader块,不能放在Pass内部: (2)#pragma sufrace surfaceFunction lightModel [option ...

  3. 【Unity Shaders】初探Surface Shader背后的机制

    转载请注明出处:http://blog.csdn.net/candycat1992/article/details/39994049 写在前面 一直以来,Unity Surface Shader背后的 ...

  4. 【Unity Shaders】Shader中的光照

    写在前面 自己写过Vertex & Fragment Shader的童鞋,大概都会对Unity的光照痛恨不已.当然,我相信这是因为我们写得少...不过这也是由于官方文档对这方面介绍很少的缘故, ...

  5. 【Unity Shaders】Shader学习资源和Surface Shader概述

    写在前面 写这篇文章的时候,我断断续续学习Unity Shader半年了,其实还是个门外汉.我也能体会很多童鞋那种想要学好Shader却无从下手的感觉.在这个期间,我找到一些学习Shader的教程以及 ...

  6. Unity Shader (三)Surface Shader机制

    转自:http://blog.csdn.net/candycat1992/article/details/39994049 写在前面 一直以来,Unity Surface Shader背后的机制一直是 ...

  7. Unity Shader——Writing Surface Shaders(3)——Surface Shader Lighting Examples

    Surface Shader 光照例子 这里有一些自定义光照模型和Surface Shaders的例子.通常的Surface Shader例子在这里. 由于延迟光照在某些自定义的逐材质光照模型中表现得 ...

  8. Unity Shader——Writing Surface Shaders(1)——Surface Shader Examples

    这里有Surface Shader的一些例子.下面的这些例子关注使用内建的光照模型:关于如何使用自定义光照模型的例子参见Surface Shader Lighting Examples. 简单 我们将 ...

  9. unity, unlit surface shader (texColor only surface shader)

    要实现双面透明无光照只有纹理色的surface shader. 错误的写法:(导致带有曝光) Shader "Custom/doubleFaceTranspTexColor" { ...

随机推荐

  1. RedisDeskTopManager连接时提示:can't nonnect to redis-server

    场景 在使用RedisDeskTopManager客户端可视化工具连接Redis服务端时提示: 注: 博客: https://blog.csdn.net/badao_liumang_qizhi关注公众 ...

  2. P2024 NOI2001 种类冰茶鸡

    展开 题目描述 动物王国中有三类动物 A,B,C,这三类动物的食物链构成了有趣的环形.A 吃 B,B 吃 C,C 吃 A. 现有 N 个动物,以 1 - N 编号.每个动物都是 A,B,C 中的一种, ...

  3. string_random

    1.随机数 import random 0-1间的随机浮点数,random.random() 指定区间随机浮点数,random.uniform(a,b) 指定区间随机整数(闭区间),random.ra ...

  4. java.lang.ClassCastException:java.util.LinkedHashMap不能转换为com.testing.models.xxx

    后台接收前台的json字符串 转pojo 问题(Object 对应定义的pojo) ObjectMapper mapper=new ObjectMapper(); Object object = ma ...

  5. 安装ubuntu到移动硬盘(UEFI+GPT),实现在别的电脑也可以使用(详细教程)

    前置说明:博主小白,第一次安装ubuntu,参考了网上很多人的教程,发博记录一下自己的安装过程.由于有些地方博主理解较浅或者因为机器硬件等各方面原因,本教程适用有限,仅供参考. 1.准备工作 win系 ...

  6. CF round 623 Div.1D Tourism 题解

    题目链接:https://codeforces.com/contest/1314/problem/D 大意: \(n\) 个顶点的有向图,顶点编号为 \(1\) 到 \(n\),任意两个不同的顶点 \ ...

  7. 剑指offer-面试题39-数组中出现次数超过一半的数字-抵消法

    /* 题目: 数组中有一个数字出现的次数超过数组长度的一半,请找出这个数字. 例如输入一个长度为9的数组{1,2,3,2,2,2,5,4,2}.由于数字2在数组中出现了5次,超过数组长度的一半,因此输 ...

  8. Enable VT-x in your BIOS security settings, ensure that HAXM is installed properly. Try disabling 3rd party security software if the problem still occurs

    win7系统安装了了AndroidStudio3.5后用模拟器报错:Enable VT-x in your BIOS security settings, ensure that HAXM is in ...

  9. 数据结构实验之栈与队列十一:refresh的停车场

    数据结构实验之栈与队列十一:refresh的停车场 Description refresh最近发了一笔横财,开了一家停车场.由于土地有限,停车场内停车数量有限,但是要求进停车场的车辆过多.当停车场满时 ...

  10. git同步代码至github和gitee(码云)

    注:本文出自博主 Chloneda:个人博客 | 博客园 | Github | Gitee | 知乎 本文源链接:https://www.cnblogs.com/chloneda/p/git-to-g ...