Planet_Halo.shader 4.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. // Upgrade NOTE: replaced '_Object2World' with 'unity_ObjectToWorld'
  2. // Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)'
  3. // Shader created with Shader Forge v1.13
  4. // Shader Forge (c) Neat Corporation / Joachim Holmer - http://www.acegikmo.com/shaderforge/
  5. // Note: Manually altering this data may prevent you from opening it in Shader Forge
  6. /*SF_DATA;ver:1.13;sub:START;pass:START;ps:flbk:NexGen/Planets/Hal,lico:0,lgpr:1,nrmq:1,nrsp:0,limd:0,spmd:1,trmd:0,grmd:0,uamb:True,mssp:True,bkdf:False,rprd:False,enco:True,rmgx:True,rpth:0,hqsc:True,hqlp:False,tesm:0,bsrc:0,bdst:0,culm:0,dpts:2,wrdp:False,dith:0,ufog:True,aust:True,igpj:True,qofs:0,qpre:3,rntp:2,fgom:False,fgoc:False,fgod:False,fgor:False,fgmd:0,fgcr:0.5,fgcg:0.5,fgcb:0.5,fgca:1,fgde:0.01,fgrn:0,fgrf:300,ofsf:0,ofsu:0,f2p0:False;n:type:ShaderForge.SFN_Final,id:1,x:34038,y:33373,varname:node_1,prsc:2|emission-6726-OUT;n:type:ShaderForge.SFN_Fresnel,id:10,x:32283,y:33115,varname:node_10,prsc:2|NRM-2482-OUT;n:type:ShaderForge.SFN_Power,id:11,x:32825,y:33234,varname:node_11,prsc:2|VAL-2481-OUT,EXP-1355-OUT;n:type:ShaderForge.SFN_Vector4,id:1355,x:32530,y:33326,varname:node_1355,prsc:2,v1:4,v2:4,v3:4,v4:4;n:type:ShaderForge.SFN_Multiply,id:1356,x:33309,y:33149,varname:node_1356,prsc:2|A-1357-OUT,B-11-OUT;n:type:ShaderForge.SFN_Slider,id:1357,x:32891,y:33083,ptovrint:False,ptlb:Power,ptin:_Power,varname:node_2305,prsc:2,min:0,cur:1,max:10;n:type:ShaderForge.SFN_LightVector,id:2473,x:32010,y:32864,varname:node_2473,prsc:2;n:type:ShaderForge.SFN_Fresnel,id:2475,x:32298,y:33372,varname:node_2475,prsc:2|NRM-2477-OUT;n:type:ShaderForge.SFN_NormalVector,id:2477,x:32091,y:33372,prsc:2,pt:False;n:type:ShaderForge.SFN_Dot,id:2481,x:32557,y:33050,varname:node_2481,prsc:2,dt:0|A-10-OUT,B-2475-OUT;n:type:ShaderForge.SFN_OneMinus,id:2482,x:32118,y:33009,varname:node_2482,prsc:2|IN-2473-OUT;n:type:ShaderForge.SFN_Color,id:8321,x:33254,y:33429,ptovrint:False,ptlb:Color Tint,ptin:_ColorTint,varname:node_8321,prsc:2,glob:False,c1:0,c2:0.4206896,c3:1,c4:1;n:type:ShaderForge.SFN_Multiply,id:6726,x:33551,y:33326,varname:node_6726,prsc:2|A-1356-OUT,B-8321-RGB;proporder:1357-8321;pass:END;sub:END;*/
  7. Shader "NexGen/Planets/Halo" {
  8. Properties {
  9. _Power ("Power", Range(0, 10)) = 1
  10. _ColorTint ("Color Tint", Color) = (0,0.4206896,1,1)
  11. }
  12. SubShader {
  13. Tags {
  14. "IgnoreProjector"="True"
  15. "Queue"="Transparent"
  16. "RenderType"="Transparent"
  17. }
  18. Pass {
  19. Name "FORWARD"
  20. Tags {
  21. "LightMode"="ForwardBase"
  22. }
  23. Blend One One
  24. ZWrite Off
  25. CGPROGRAM
  26. #pragma vertex vert
  27. #pragma fragment frag
  28. #define UNITY_PASS_FORWARDBASE
  29. #include "UnityCG.cginc"
  30. #pragma multi_compile_fwdbase
  31. #pragma multi_compile_fog
  32. #pragma exclude_renderers xbox360 ps3
  33. #pragma target 3.0
  34. uniform float _Power;
  35. uniform float4 _ColorTint;
  36. struct VertexInput {
  37. float4 vertex : POSITION;
  38. float3 normal : NORMAL;
  39. };
  40. struct VertexOutput {
  41. float4 pos : SV_POSITION;
  42. float4 posWorld : TEXCOORD0;
  43. float3 normalDir : TEXCOORD1;
  44. UNITY_FOG_COORDS(2)
  45. };
  46. VertexOutput vert (VertexInput v) {
  47. VertexOutput o = (VertexOutput)0;
  48. o.normalDir = UnityObjectToWorldNormal(v.normal);
  49. o.posWorld = mul(unity_ObjectToWorld, v.vertex);
  50. o.pos = UnityObjectToClipPos(v.vertex);
  51. UNITY_TRANSFER_FOG(o,o.pos);
  52. return o;
  53. }
  54. float4 frag(VertexOutput i) : COLOR {
  55. i.normalDir = normalize(i.normalDir);
  56. /////// Vectors:
  57. float3 viewDirection = normalize(_WorldSpaceCameraPos.xyz - i.posWorld.xyz);
  58. float3 normalDirection = i.normalDir;
  59. float3 lightDirection = normalize(_WorldSpaceLightPos0.xyz);
  60. ////// Lighting:
  61. ////// Emissive:
  62. float3 emissive = ((_Power*pow(dot((1.0-max(0,dot((1.0 - lightDirection), viewDirection))),(1.0-max(0,dot(i.normalDir, viewDirection)))),float4(4,4,4,4)))*_ColorTint.rgb).rgb;
  63. float3 finalColor = emissive;
  64. fixed4 finalRGBA = fixed4(finalColor,1);
  65. UNITY_APPLY_FOG(i.fogCoord, finalRGBA);
  66. return finalRGBA;
  67. }
  68. ENDCG
  69. }
  70. }
  71. FallBack "NexGen/Planets/Hal"
  72. CustomEditor "ShaderForgeMaterialInspector"
  73. }