// Upgrade NOTE: replaced '_World2Object' with 'unity_WorldToObject'

// Upgrade NOTE: replaced '_World2Object' with 'unity_WorldToObject'

Shader "Custom/RadarWave" {
Properties {
_Color ("Color", Color) = (,,,)
_MainTex ("Albedo (RGB)", 2D) = "white" {}
_Glossiness ("Smoothness", Range(,)) = 0.5
_Metallic ("Metallic", Range(,)) = 0.0
_TransVal("Transparency Value", Range(,)) = 0.5
_StripWidth("Strip Width", Range(0.1,)) = 0.2
_Speed("Speed", Range(,)) =
}
SubShader {
Tags { "RenderType"="Opaque" "Queue" = "Transparent" }
LOD
//Cull Off//关闭背面裁剪
//Lighting Off//此设置在surface shader中不起作用,貌似是在Unlit Shader中使用的
//ZWrite On
//ZTest On
Blend SrcAlpha OneMinusSrcAlpha CGPROGRAM
// Physically based Standard lighting model, and enable shadows on all light types
//#pragma surface surf Standard fullforwardshadows alpha vertex:vert
#pragma surface surf NoLightModel fullforwardshadows alpha vertex:vert // Use shader model 3.0 target, to get nicer looking lighting
#pragma target 3.0 sampler2D _MainTex; struct Input {
float2 uv_MainTex;
float4 modelPos_;
}; half _Glossiness;
half _Metallic;
half _TransVal;
half _StripWidth;
half _Speed;
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_CBUFFER_START(Props)
// put more per-instance properties here
UNITY_INSTANCING_CBUFFER_END void surf(Input IN, inout SurfaceOutput o) {
// Albedo comes from a texture tinted by color
fixed4 c = tex2D(_MainTex, IN.uv_MainTex) * _Color;
o.Albedo = c.rgb;
//float4 tmp = mul(unity_WorldToObject, IN.modelPos_);
if (fmod(floor((IN.modelPos_.z-_Time.y*_Speed)/ _StripWidth),)!=)
{
//clip(-1);
discard;
}
//o.Alpha = c.a;
o.Alpha = _TransVal;
} void vert(inout appdata_full v, out Input o)
{
UNITY_INITIALIZE_OUTPUT(Input, o);
o.modelPos_ = v.vertex;
} //命名规则:Lighting接#pragma suface之后起的名字
//lightDir :点到光源的单位向量 viewDir:点到摄像机的单位向量 atten:衰减系数
float4 LightingNoLightModel(SurfaceOutput s, float3 lightDir, half3 viewDir, half atten)
{
float4 c;
c.rgb = s.Albedo;
c.a = s.Alpha;
return c;
} ENDCG
}
FallBack "Diffuse"
}

Unity关闭shader中的光照模型以及如何自定义光照模型的更多相关文章

  1. [Unity]在Shader中获取摄像机角度、视线的问题

    又踩了一坑,好在谷歌到了之前的一个人遇到相同的问题,顺利解决. 先说说问题背景,我目前的毕设是体数据渲染,实现的办法是raycast.最基本的一点就是在fragment program里,获取rayc ...

  2. Unity Shader入门教程(三)自制光照模型

    光照模型的概念目前还不明晰,因为笔者也是一个初学者,所以请小心对待笔者介绍的内容.笔者认为光照模型是规定光照算法的模型,比如说前面提到的Lambert光照模型,规定了材质表面的光线的表达式为 环境光+ ...

  3. 【Unity Shaders】Shader中的光照

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

  4. 【Unity Shaders】Diffuse Shading——在Surface Shader中使用properties

    本系列主要参考<Unity Shaders and Effects Cookbook>一书(感谢原书作者),同时会加上一点个人理解或拓展. 这里是本书所有的插图.这里是本书所需的代码和资源 ...

  5. unity, multi pass shader中的surface pass

    今天尝试写一个multi pass shader,但其中有一个Pass是surface pass,总是莫名奇妙地报错.后来看到下面帖子: http://forum.unity3d.com/thread ...

  6. unity, shader中获得当前像素深度

    frag shader中直接访问i.pos.z就是深度,不必除以i.pos.w,因为系统已经自动进行过了透视除法且已将i.pos.w置为0.

  7. 【淡墨Unity3D Shader计划】五 圣诞用品: Unity在Shader三种形式的控制&amp;混合操作编译

    本系列文章由@浅墨_毛星云 出品,转载请注明出处. 文章链接:http://blog.csdn.net/poem_qianmo/article/details/42060963 作者:毛星云(浅墨)  ...

  8. Unity的shader学习1

    先来看一段我们项目常见的Shader代码,这个是Vertex&Fragment shader,目前已经不常用了,不过还是适合我们理解一些基础知识和理解一些比较老的shader 代码.下次我们再 ...

  9. [转] Draw Call未被批处理?告诉你在Unity 5.6中如何查找原因 [复制链接]

    Unity在5.6之前的版本中并未提供很直接的方式来查找Draw Call未被批处理的原因,但Unity 5.6在Frame Debugger中新增了一项功能,帮助开发者查找相关信息.今天这篇文章就为 ...

随机推荐

  1. Javascript动态操作CSS总结

    一.使用js操作css属性的写法 1.对于没有中划线的css属性一般直接使用style.属性名即可. 如:obj.style.margin,obj.style.width,obj.style.left ...

  2. 关于Unity中定时器的简易使用

    定时器 一段指定的时间后执行某个函数或者某个语句 用法 //定时器写法1 flaot total_time; void Update(){ this.total_time += (Time.delta ...

  3. Unity---------Particle Effect详情

    Effects:效果/特效. Particle System:粒子系统.可用于创建烟雾.气流.火焰.涟漪等效果. 在Unity3D 3.5版本之后退出了新的shuriken粒子系统:   添加组件之后 ...

  4. adv7180驱动

    http://download.csdn.net/download/u013308744/9945184 http://www.ebaina.com/bbs/thread-10121-1-1.html ...

  5. Error configuring application listener of class org.springframework.web.context.ContextLoaderListener

    严重:   Error   configuring   application   listener   of   class   org.springframework.web.context.Co ...

  6. php 统计fasta 序列长度和GC含量

    最近php7的消息铺天盖地, 忍不住想尝试下.星期天看了下语法, 写个小脚本练下手: 这个脚本读取fasta 文件, 输出序列的长度和GC含量: <?php $fasta = "tes ...

  7. excel做回归分析的应用【风控数据分析】

    方法1     统计逻辑:统计一个loginname的所有去重的通讯录数C,统计这个Loginname对应的每个设备对应的通讯录c1,c2,c3…cn; X=(c1/c+c2/c+c3/c+….cn/ ...

  8. Nginx系列6之-rewirte功能使用案例总结

    使用案例1 网站架构如下: 公司部分服务器目前通过二级目录来调度到不同的服务器,如下所示: 按照上述需求,我们此时就配置了两个location,如下所示: [root@localhost nginx] ...

  9. MongoDB 连接池

    http://www.cnblogs.com/huangfox/archive/2012/04/01/2428947.html http://www.iteye.com/problems/97350

  10. 本地存储(LocalStorage、SessionStorage、Web SQL Database、Indexed DB)

    https://www.cnblogs.com/SeeYouBug/p/6127001.html https://blog.csdn.net/inter_peng/article/details/49 ...