unity自发光透明shader

这本来是一个glass的shader,但是我发现也可以用到自发光+透明,这两个脚本都是unity文档里面的。呵呵~~~

[html] view plaincopyprint?
  1. Shader "Custom/AlphaSelfIllum" {
  2. Properties {
  3. _Color ("Main Color", Color) = (1,1,1,0)
  4. _SpecColor ("Spec Color", Color) = (1,1,1,1)
  5. _Emission ("Emmisive Color", Color) = (0,0,0,0)
  6. _Shininess ("Shininess", Range (0.01, 1)) = 0.7
  7. _MainTex ("Base (RGB)", 2D) = "white" { }
  8. }
  9. SubShader {
  10. // We use the material in many passes by defining them in the subshader.
  11. // Anything defined here becomes default values for all contained passes.
  12. Material {
  13. Diffuse [_Color]
  14. Ambient [_Color]
  15. Shininess [_Shininess]
  16. Specular [_SpecColor]
  17. Emission [_Emission]
  18. }
  19. Lighting On
  20. SeparateSpecular On
  21. // Set up alpha blending
  22. Blend SrcAlpha OneMinusSrcAlpha
  23. // Render the back facing parts of the object.
  24. // If the object is convex, these will always be further away
  25. // than the front-faces.
  26. //控制前面透明度
  27. //Pass {
  28. //    Cull Front
  29. //    SetTexture [_MainTex] {
  30. //        Combine Primary * Texture
  31. //    }
  32. //}
  33. // Render the parts of the object facing us.
  34. // If the object is convex, these will be closer than the
  35. // back-faces.
  36. //控制后面透明度
  37. Pass {
  38. Cull Back
  39. SetTexture [_MainTex] {
  40. Combine Primary * Texture
  41. }
  42. }
  43. }
  44. }
Shader "Custom/AlphaSelfIllum" {
Properties {_Color ("Main Color", Color) = (1,1,1,0)_SpecColor ("Spec Color", Color) = (1,1,1,1)_Emission ("Emmisive Color", Color) = (0,0,0,0)_Shininess ("Shininess", Range (0.01, 1)) = 0.7_MainTex ("Base (RGB)", 2D) = "white" { }}SubShader {// We use the material in many passes by defining them in the subshader.// Anything defined here becomes default values for all contained passes.Material {Diffuse [_Color]Ambient [_Color]Shininess [_Shininess]Specular [_SpecColor]Emission [_Emission]}Lighting OnSeparateSpecular On// Set up alpha blendingBlend SrcAlpha OneMinusSrcAlpha// Render the back facing parts of the object.// If the object is convex, these will always be further away// than the front-faces.  //控制前面透明度      //Pass {//    Cull Front//    SetTexture [_MainTex] {//        Combine Primary * Texture//    }//}// Render the parts of the object facing us.// If the object is convex, these will be closer than the// back-faces.//控制后面透明度  Pass {Cull BackSetTexture [_MainTex] {Combine Primary * Texture}}}
} 
[html] view plaincopyprint?
  1. Shader "Custom/Fog" {
  2. Properties {
  3. _MainTex ("Texture", 2D) = "white" {}
  4. _FogColor ("Fog Color", Color) = (0.3, 0.4, 0.7, 1.0)
  5. }
  6. SubShader {
  7. Tags { "RenderType" = "Opaque" }
  8. CGPROGRAM
  9. #pragma surface surf Lambert finalcolor:mycolor vertex:myvert
  10. struct Input {
  11. float2 uv_MainTex;
  12. half fog;
  13. };
  14. void myvert (inout appdata_full v, out Input data)
  15. {
  16. float4 hpos = mul (UNITY_MATRIX_MVP, v.vertex);
  17. data.fog = min (1, dot (hpos.xy, hpos.xy) * 0.1);
  18. }
  19. fixed4 _FogColor;
  20. void mycolor (Input IN, SurfaceOutput o, inout fixed4 color)
  21. {
  22. fixed3 fogColor = _FogColor.rgb;
  23. #ifdef UNITY_PASS_FORWARDADD
  24. fogColor = 0;
  25. #endif
  26. color.rgb = lerp (color.rgb, fogColor, IN.fog);
  27. }
  28. sampler2D _MainTex;
  29. void surf (Input IN, inout SurfaceOutput o) {
  30. o.Albedo = tex2D (_MainTex, IN.uv_MainTex).rgb;
  31. }
  32. ENDCG
  33. }
  34. Fallback "Diffuse"
  35. }

转载于:https://www.cnblogs.com/xiao-wei-wei/archive/2013/03/23/2977222.html

unity自发光透明shader相关推荐

  1. Unity学习之Shader

    Shader 是用来实现图像渲染的,用来替代固定渲染管线的可编辑程序.其中Vertex Shader(顶点着色器)主要负责顶点的几何关系等的运算,Pixel Shader(像素着色器)主要负责片元颜色 ...

  2. Unity3D Shader编程】之二 雪山飞狐篇:Unity的基本Shader框架写法颜色、光照与材质

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

  3. 【Unity3D Shader编程】之十三 单色透明Shader 标准镜面高光Shader

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

  4. 【Unity3D Shader编程】之十三 单色透明Shader 标准镜面高光Shader

    分享一下我老师大神的人工智能教程!零基础,通俗易懂!http://blog.csdn.net/jiangjunshow 也欢迎大家转载本篇文章.分享知识,造福人民,实现我们中华民族伟大复兴! 本系列文 ...

  5. unity 水晶 石头 shader

    unity 水晶 石头 shader 上shader Shader "Unlit/CrystalTest" {Properties{_LayerTex ("Layer T ...

  6. Unity双面材质Shader

    Unity双面材质Shader. 正面渲染支持漫反射贴图.法线贴图.高光度等.背面渲染支持漫反射贴图. Shader代码如下: Shader "LiangHaoXiangShaders/Do ...

  7. Unity 3D开发--Shader入门基础

    Shader "Unlit/xxShader" {Properties{//基础属性 并可以显示在属性板上_MainTex ("Texture", 2D) = ...

  8. Unity 自定义自发光材质 shader (对比Standard Eimission)

    自定义自发光shader的时候会遇到 同样的HDR 颜色,但是standard表现正常而自己写的shader不正常的情况. 原因是因为Bloom效果是基于 standard的泛光材质调的,而自己写的E ...

  9. unity 太阳自发光_unity shader基础之——unity中实现环境光、自发光

    上篇主要讲的是unity中的光照模型及其原理,还有几种光照类型(自发光.环境光.漫反射.高光反射),后面几篇文章就开始在unity中实现这几种光照类型,本篇在unity实现自发光.环境光. 一.uni ...

最新文章

  1. Big Data Security Part One: Introducing PacketPig
  2. 创业公司崛起靠加班?别闹了,早死才靠加班
  3. BAT 批处理命令 - 解决cmd控制台中文乱码问题实例演示
  4. boost::multiprecision模块random相关的测试程序
  5. 25岁,在一个需要工作的周末……
  6. Drools与Spring集成 登录测试
  7. MySQL-常用引擎
  8. WCF消息之XmlDictionaryWriter
  9. SQL Server中的登录触发器概述
  10. mysql 数据库乱码的解决办法_数据库 MySQL中文乱码解决办法总结
  11. LUOGU P4178 Tree
  12. linux c 开发
  13. 图文并茂!60页PPT《快速入门python学习路线》学不会你找我
  14. #FME#FME将TXT转成shape
  15. x86、ARM和MIPS三种主流芯片架构
  16. 由于找不到MSVCR100.dll,无法继续执行代码解决方法
  17. Halcon 阈值算子汇总
  18. 《延禧攻略》知识点整理,没看剧的看思维导图就够啦
  19. 黑客攻击欧洲港口石油设施致油价飙升、上海首份《企业数据合规指引》出台、微软计划收购网络安全公司|网络安全周报
  20. Mysql修改数据库名

热门文章

  1. vuex 源码分析_Vuex 2.0 源码分析(下)
  2. 捕捉到了异常继续循环_前端异常处理最佳实践
  3. bat for循环_bat教程[279] reg import命令的用法
  4. 怎么查看电脑硬盘序列号
  5. win8无权限访问这台计算机,win8共享打印机无访问权限的解决方法
  6. linux进程查看所有线程,Linux中查看进程的多线程的方法
  7. 提交客户端证书_MQTT X v1.3.3 正式发布 - 跨平台 MQTT 5.0 桌面测试客户端
  8. mysql聚簇索引存储结构_MySQL聚簇索引的实际应用于结构描述
  9. 交大计算机基础知识第一次作业,上海交大计算机第一次作业
  10. GAN生成对抗网络-GAN原理与基本实现-入门实例02