//Fog Halo PS
cbuffer _Globals : register(b4)
{
  float2 gm_vTextureSizeInv : packoffset(c0);
  float3 ColorModulate_01_Color2 : packoffset(c1);
  float4 Multiply_01_V2 : packoffset(c2);
  float4 Multiply_02_V2 : packoffset(c3);
  float4 Multiply_04_V2 : packoffset(c4);
  float VSObjectNearDistanceKill_01_KillDistance : packoffset(c5);
  float VSDistanceFade_01_InStartDistance : packoffset(c5.y);
  float VSDistanceFade_01_InEndDistance : packoffset(c5.z);
  float VSDistanceFade_01_OutStartDistance : packoffset(c5.w);
  float VSDistanceFade_01_OutEndDistance : packoffset(c6);
  float VSDistanceFade_01_StartAngle : packoffset(c6.y);
  float VSDistanceFade_01_EndAngle : packoffset(c6.z);
}

cbuffer _cbSharedPerViewData : register(b1)
{

  struct
  {
    row_major float4x4 mProjection;
    row_major float4x4 mViewToViewport;
    row_major float4x4 mViewToWorld;
    float4 vViewRemap;
    float4 vViewDepthRemap;
    float4 vEyeVectorUL;
    float4 vEyeVectorLR;
    float4 v4ShadowRange;
    float4 vViewSpaceUpVector;
    float4 vGlobalLitFactor;
    float4 vViewportSize;
    float4 vEngineTime;
    float4 vShaderColor0;
    float4 vShaderColor1;
    float4 vShaderColor2;
    float4 vShaderColor3;
    float4 vShaderColor4;
    float4 vClipPlane;
  } cbSharedPerViewData : packoffset(c0);

}
SamplerState samplerDeferred0_s : register(s0);
SamplerState samplerTexture_01_s : register(s1);
Texture2D<float4> mapDeferred0 : register(t0);
Texture2D<float4> mapTexture_01 : register(t1);

Texture2D<float4> StereoParams : register(t125);
Texture1D<float4> IniParams : register(t120);

void main( 
  float4 v0 : SV_POSITION0,
  float4 v1 : TEXCOORD0,
  float4 v2 : TEXCOORD1,
  float4 v3 : TEXCOORD2,
  out float4 o0 : SV_TARGET0)
{
  float4 r0,r1;
  uint4 bitmask, uiDest;
  float4 fDest;

  
  
  r0.x = cbSharedPerViewData.vEngineTime.x * Multiply_02_V2.x;
  r0.y = r0.x >= -r0.x;
  r0.x = frac(abs(r0.x));
  r0.x = r0.y ? r0.x : -r0.x;
  r0.z = cbSharedPerViewData.vEngineTime.x * Multiply_04_V2.x;
  r0.w = r0.z >= -r0.z;
  r0.z = frac(abs(r0.z));
  r0.z = r0.w ? r0.z : -r0.z;
  r0.xy = v3.xy + r0.xz;
  r0.xyzw = mapTexture_01.Sample(samplerTexture_01_s, r0.xy).xyzw;
  r0.xyz = Multiply_01_V2.xyz * r0.xyz;
  r0.xyz = ColorModulate_01_Color2.xyz * r0.xyz;
  r1.xyz = cbSharedPerViewData.mViewToViewport._m10_m11_m13 * v1.yyy;
  
  float4 stereo = StereoParams.Load(0);
  //v1.x += stereo.x * (v1.w - stereo.y) / cbSharedPerViewData.vClipPlane.x;
  //r1.x -= stereo.x * (r1.z - stereo.y);
  
  r1.xyz = v1.xxx * cbSharedPerViewData.mViewToViewport._m00_m01_m03 + r1.xyz;
  r1.xyz = v1.zzz * cbSharedPerViewData.mViewToViewport._m20_m21_m23 + r1.xyz;
  r1.xyz = v1.www * cbSharedPerViewData.mViewToViewport._m30_m31_m33 + r1.xyz;
  r1.xy = r1.xy / r1.zz;
  
  r1.xyzw = mapDeferred0.Sample(samplerDeferred0_s, r1.xy).xyzw;
  r0.w = cbSharedPerViewData.vViewDepthRemap.z * r1.x + -cbSharedPerViewData.vViewDepthRemap.y;
  r0.w = -cbSharedPerViewData.vViewDepthRemap.x / r0.w;
  r1.x = v1.z / v1.w;
  r0.w = r1.x + -r0.w;
  r0.w = saturate(r0.w + r0.w);
  r1.xyz = v2.xyz * r0.www;
  o0.xyz = r1.xyz * r0.xyz;
  o0.w = 1;
  
  //o0 = 0;
  
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.27.952.3022
//
//   using 3Dmigoto v1.2.6 on Fri Nov 06 18:16:36 2015
//
//
// Buffer Definitions: 
//
// cbuffer $Globals
// {
//
//   float2 gm_vTextureSizeInv;         // Offset:    0 Size:     8 [unused]
//   float3 ColorModulate_01_Color2;    // Offset:   16 Size:    12
//   float4 Multiply_01_V2;             // Offset:   32 Size:    16
//   float4 Multiply_02_V2;             // Offset:   48 Size:    16
//   float4 Multiply_04_V2;             // Offset:   64 Size:    16
//   float VSObjectNearDistanceKill_01_KillDistance;// Offset:   80 Size:     4 [unused]
//   float VSDistanceFade_01_InStartDistance;// Offset:   84 Size:     4 [unused]
//   float VSDistanceFade_01_InEndDistance;// Offset:   88 Size:     4 [unused]
//   float VSDistanceFade_01_OutStartDistance;// Offset:   92 Size:     4 [unused]
//   float VSDistanceFade_01_OutEndDistance;// Offset:   96 Size:     4 [unused]
//   float VSDistanceFade_01_StartAngle;// Offset:  100 Size:     4 [unused]
//   float VSDistanceFade_01_EndAngle;  // Offset:  104 Size:     4 [unused]
//
// }
//
// cbuffer _cbSharedPerViewData
// {
//
//   struct
//   {
//       
//       row_major float4x4 mProjection;// Offset:    0
//       row_major float4x4 mViewToViewport;// Offset:   64
//       row_major float4x4 mViewToWorld;// Offset:  128
//       float4 vViewRemap;             // Offset:  192
//       float4 vViewDepthRemap;        // Offset:  208
//       float4 vEyeVectorUL;           // Offset:  224
//       float4 vEyeVectorLR;           // Offset:  240
//       float4 v4ShadowRange;          // Offset:  256
//       float4 vViewSpaceUpVector;     // Offset:  272
//       float4 vGlobalLitFactor;       // Offset:  288
//       float4 vViewportSize;          // Offset:  304
//       float4 vEngineTime;            // Offset:  320
//       float4 vShaderColor0;          // Offset:  336
//       float4 vShaderColor1;          // Offset:  352
//       float4 vShaderColor2;          // Offset:  368
//       float4 vShaderColor3;          // Offset:  384
//       float4 vShaderColor4;          // Offset:  400
//       float4 vClipPlane;             // Offset:  416
//
//   } cbSharedPerViewData;             // Offset:    0 Size:   432
//
// }
//
//
// Resource Bindings:
//
// Name                                 Type  Format         Dim Slot Elements
// ------------------------------ ---------- ------- ----------- ---- --------
// samplerDeferred0                  sampler      NA          NA    0        1
// samplerTexture_01                 sampler      NA          NA    1        1
// mapDeferred0                      texture  float4          2d    0        1
// mapTexture_01                     texture  float4          2d    1        1
// _cbSharedPerViewData              cbuffer      NA          NA    1        1
// $Globals                          cbuffer      NA          NA    4        1
//
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float       
// TEXCOORD                 0   xyzw        1     NONE   float   xyzw
// TEXCOORD                 1   xyzw        2     NONE   float   xyz 
// TEXCOORD                 2   xyzw        3     NONE   float   xy  
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_TARGET                0   xyzw        0   TARGET   float   xyzw
//
ps_4_0
dcl_constantbuffer cb4[5], immediateIndexed
dcl_constantbuffer cb1[21], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_input_ps linear v1.xyzw
dcl_input_ps linear v2.xyz
dcl_input_ps linear v3.xy
dcl_output o0.xyzw
dcl_temps 2
mul r0.x, cb4[3].x, cb1[20].x
ge r0.y, r0.x, -r0.x
frc r0.x, |r0.x|
movc r0.x, r0.y, r0.x, -r0.x
mul r0.z, cb4[4].x, cb1[20].x
ge r0.w, r0.z, -r0.z
frc r0.z, |r0.z|
movc r0.z, r0.w, r0.z, -r0.z
add r0.xy, r0.xzxx, v3.xyxx
sample r0.xyzw, r0.xyxx, t1.xyzw, s1
mul r0.xyz, r0.xyzx, cb4[2].xyzx
mul r0.xyz, r0.xyzx, cb4[1].xyzx
mul r1.xyz, v1.yyyy, cb1[5].xywx
mad r1.xyz, v1.xxxx, cb1[4].xywx, r1.xyzx
mad r1.xyz, v1.zzzz, cb1[6].xywx, r1.xyzx
mad r1.xyz, v1.wwww, cb1[7].xywx, r1.xyzx
div r1.xy, r1.xyxx, r1.zzzz
sample r1.xyzw, r1.xyxx, t0.xyzw, s0
mad r0.w, cb1[13].z, r1.x, -cb1[13].y
div r0.w, -cb1[13].x, r0.w
div r1.x, v1.z, v1.w
add r0.w, -r0.w, r1.x
add_sat r0.w, r0.w, r0.w
mul r1.xyz, r0.wwww, v2.xyzx
mul o0.xyz, r0.xyzx, r1.xyzx
mov o0.w, l(1.000000)
ret 
// Approximately 27 instruction slots used

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~*/
