//Glass
cbuffer _Globals : register(b4)
{
  float2 gm_vTextureSizeInv : packoffset(c0);
  float4 Multiply_03_V2 : packoffset(c1);
  float1 TextureRefraction_01_Scale : packoffset(c2);
  float1 TextureNormal_01_BumpScale : packoffset(c2.y);
  float4 Multiply_02_V2 : packoffset(c3);
  float3 ConstantColorRGB_01_Value : packoffset(c4);
  float Fresnel_01_Power : packoffset(c4.w);
  float Fresnel_01_Minimum : packoffset(c5);
  float Fresnel_01_Maximum : packoffset(c5.y);
}

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 samplerRefraction2D_s : register(s0);
SamplerState samplerRefractionMask2D_s : register(s1);
SamplerState samplerDiffuse_01_s : register(s2);
SamplerState samplerTextureNormal_01_s : register(s3);
SamplerState samplerTextureCube_01_s : register(s4);
Texture2D<float4> mapRefraction2D : register(t0);
Texture2D<float4> mapRefractionMask2D : register(t1);
Texture2D<float4> mapDiffuse_01 : register(t2);
Texture2D<float4> mapTextureNormal_01 : register(t3);
TextureCube<float4> mapTextureCube_01 : register(t4);

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

void main( 
  float4 v0 : SV_POSITION0,
  float4 v1 : TEXCOORD0,
  float4 v2 : TEXCOORD2,
  float4 v3 : TEXCOORD3,
  float4 v4 : TEXCOORD4,
  float4 v5 : TEXCOORD5,
  float4 v6 : TEXCOORD6,
  float4 v7 : TEXCOORD7,
  out float4 o0 : SV_TARGET0)
{
  float4 r0,r1,r2,r3;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xyzw = mapTextureNormal_01.Sample(samplerTextureNormal_01_s, v2.xy).xyzw;
  r0.xy = float2(-0.5,-0.5) + r0.xy;
  r0.xy = saturate(r0.xy * TextureNormal_01_BumpScale + float2(0.5,0.5));
  r0.xy = float2(-0.5,-0.5) + r0.xy;
  r0.xy = r0.xy + r0.xy;
  r0.zw = v5.xy * r0.yy;
  r0.zw = v4.xy * r0.xx + r0.zw;
  r0.x = dot(r0.xy, r0.xy);
  r0.x = min(1, r0.x);
  r0.x = 1 + -r0.x;
  r0.x = sqrt(r0.x);
  r0.xy = v3.xy * r0.xx + r0.zw;
  r0.xy = TextureRefraction_01_Scale * -r0.xy;
  r1.xyz = cbSharedPerViewData.mViewToViewport._m10_m11_m13 * v1.yyy;
  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;
  r0.zw = r1.xy / r1.zz;
  r1.xy = -r0.xy * cbSharedPerViewData.vViewportSize.xy + r0.zw;
  r0.xy = cbSharedPerViewData.vViewportSize.xy * r0.xy;
  r1.xyzw = mapRefractionMask2D.SampleLevel(samplerRefractionMask2D_s, r1.xy, 0).xyzw;
  r1.x = 0.5 < r1.x;
  r1.x = r1.x ? 1.000000 : 0;
  r0.xy = -r0.xy * r1.xx + r0.zw;
  r0.xyzw = mapRefraction2D.SampleLevel(samplerRefraction2D_s, r0.xy, 0).xyzw;
  r1.x = 0 >= r0.w;
  r1.x = r1.x ? 1.000000 : 0;
  r1.yzw = r0.xyz / r0.www;
  r0.xyz = -r1.yzw + r0.xyz;
  r0.xyz = r1.xxx * r0.xyz + r1.yzw;
  r0.xyz = Multiply_03_V2.xyz * r0.xyz;
  r0.w = dot(v1.xyz, v3.xyz);
  r0.w = r0.w + r0.w;
  r1.xyz = v3.xyz * -r0.www + v1.xyz;
  r2.xyz = cbSharedPerViewData.mViewToWorld._m10_m12_m11 * r1.yyy;
  r1.xyw = r1.xxx * cbSharedPerViewData.mViewToWorld._m00_m02_m01 + r2.xyz;
  r1.xyz = r1.zzz * cbSharedPerViewData.mViewToWorld._m20_m22_m21 + r1.xyw;
  r1.xyzw = mapTextureCube_01.Sample(samplerTextureCube_01_s, r1.xyz).xyzw;
  r1.xyz = ConstantColorRGB_01_Value.xyz * r1.xyz;
  r1.xyz = Multiply_02_V2.xyz * r1.xyz;
  r0.w = dot(-v1.xyz, -v1.xyz);
  r0.w = rsqrt(r0.w);
  r2.xyz = -v1.xyz * r0.www;
  r0.w = dot(v3.xyz, v3.xyz);
  r0.w = rsqrt(r0.w);
  r3.xyz = v3.xyz * r0.www;
  r0.w = saturate(dot(r2.xyz, r3.xyz));
  r0.w = 1 + -r0.w;
  r0.w = log2(r0.w);
  r0.w = Fresnel_01_Power * r0.w;
  r0.w = exp2(r0.w);
  r1.w = Fresnel_01_Maximum + -Fresnel_01_Minimum;
  r0.w = r0.w * r1.w + Fresnel_01_Minimum;
  r2.xyzw = mapDiffuse_01.Sample(samplerDiffuse_01_s, v2.xy).xyzw;
  r0.w = r2.w + r0.w;
  r1.xyz = r0.www * r1.xyz;
  o0.xyz = r2.xyz * r0.xyz + r1.xyz;
  o0.w = 1;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) HLSL Shader Compiler 9.27.952.3022
//
//   using 3Dmigoto v1.2.9 on Fri Dec 18 17:17:16 2015
//
//
// Buffer Definitions: 
//
// cbuffer $Globals
// {
//
//   float2 gm_vTextureSizeInv;         // Offset:    0 Size:     8 [unused]
//   float4 Multiply_03_V2;             // Offset:   16 Size:    16
//   float1 TextureRefraction_01_Scale; // Offset:   32 Size:     4
//   float1 TextureNormal_01_BumpScale; // Offset:   36 Size:     4
//   float4 Multiply_02_V2;             // Offset:   48 Size:    16
//   float3 ConstantColorRGB_01_Value;  // Offset:   64 Size:    12
//   float Fresnel_01_Power;            // Offset:   76 Size:     4
//   float Fresnel_01_Minimum;          // Offset:   80 Size:     4
//   float Fresnel_01_Maximum;          // Offset:   84 Size:     4
//
// }
//
// 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
// ------------------------------ ---------- ------- ----------- ---- --------
// samplerRefraction2D               sampler      NA          NA    0        1
// samplerRefractionMask2D           sampler      NA          NA    1        1
// samplerDiffuse_01                 sampler      NA          NA    2        1
// samplerTextureNormal_01           sampler      NA          NA    3        1
// samplerTextureCube_01             sampler      NA          NA    4        1
// mapRefraction2D                   texture  float4          2d    0        1
// mapRefractionMask2D               texture  float4          2d    1        1
// mapDiffuse_01                     texture  float4          2d    2        1
// mapTextureNormal_01               texture  float4          2d    3        1
// mapTextureCube_01                 texture  float4        cube    4        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                 2   xyzw        2     NONE   float   xy  
// TEXCOORD                 3   xyzw        3     NONE   float   xyz 
// TEXCOORD                 4   xyzw        4     NONE   float   xy  
// TEXCOORD                 5   xyzw        5     NONE   float   xy  
// TEXCOORD                 6   xyzw        6     NONE   float       
// TEXCOORD                 7   xyzw        7     NONE   float       
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_TARGET                0   xyzw        0   TARGET   float   xyzw
//
ps_4_0
dcl_constantbuffer cb4[6], immediateIndexed
dcl_constantbuffer cb1[20], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s2, mode_default
dcl_sampler s3, mode_default
dcl_sampler s4, mode_default
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_resource_texture2d (float,float,float,float) t2
dcl_resource_texture2d (float,float,float,float) t3
dcl_resource_texturecube (float,float,float,float) t4
dcl_input_ps linear v1.xyzw
dcl_input_ps linear v2.xy
dcl_input_ps linear v3.xyz
dcl_input_ps linear v4.xy
dcl_input_ps linear v5.xy
dcl_output o0.xyzw
dcl_temps 4
sample r0.xyzw, v2.xyxx, t3.xyzw, s3
add r0.xy, r0.xyxx, l(-0.500000, -0.500000, 0.000000, 0.000000)
mad_sat r0.xy, r0.xyxx, cb4[2].yyyy, l(0.500000, 0.500000, 0.000000, 0.000000)
add r0.xy, r0.xyxx, l(-0.500000, -0.500000, 0.000000, 0.000000)
add r0.xy, r0.xyxx, r0.xyxx
mul r0.zw, r0.yyyy, v5.xxxy
mad r0.zw, v4.xxxy, r0.xxxx, r0.zzzw
dp2 r0.x, r0.xyxx, r0.xyxx
min r0.x, r0.x, l(1.000000)
add r0.x, -r0.x, l(1.000000)
sqrt r0.x, r0.x
mad r0.xy, v3.xyxx, r0.xxxx, r0.zwzz
mul r0.xy, -r0.xyxx, cb4[2].xxxx
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 r0.zw, r1.xxxy, r1.zzzz
mad r1.xy, -r0.xyxx, cb1[19].xyxx, r0.zwzz
mul r0.xy, r0.xyxx, cb1[19].xyxx
sample_l r1.xyzw, r1.xyxx, t1.xyzw, s1, l(0.000000)
lt r1.x, l(0.500000), r1.x
and r1.x, r1.x, l(0x3f800000)
mad r0.xy, -r0.xyxx, r1.xxxx, r0.zwzz
sample_l r0.xyzw, r0.xyxx, t0.xyzw, s0, l(0.000000)
ge r1.x, l(0.000000), r0.w
and r1.x, r1.x, l(0x3f800000)
div r1.yzw, r0.xxyz, r0.wwww
add r0.xyz, r0.xyzx, -r1.yzwy
mad r0.xyz, r1.xxxx, r0.xyzx, r1.yzwy
mul r0.xyz, r0.xyzx, cb4[1].xyzx
dp3 r0.w, v1.xyzx, v3.xyzx
add r0.w, r0.w, r0.w
mad r1.xyz, v3.xyzx, -r0.wwww, v1.xyzx
mul r2.xyz, r1.yyyy, cb1[9].xzyx
mad r1.xyw, r1.xxxx, cb1[8].xzxy, r2.xyxz
mad r1.xyz, r1.zzzz, cb1[10].xzyx, r1.xywx
sample r1.xyzw, r1.xyzx, t4.xyzw, s4
mul r1.xyz, r1.xyzx, cb4[4].xyzx
mul r1.xyz, r1.xyzx, cb4[3].xyzx
dp3 r0.w, -v1.xyzx, -v1.xyzx
rsq r0.w, r0.w
mul r2.xyz, r0.wwww, -v1.xyzx
dp3 r0.w, v3.xyzx, v3.xyzx
rsq r0.w, r0.w
mul r3.xyz, r0.wwww, v3.xyzx
dp3_sat r0.w, r2.xyzx, r3.xyzx
add r0.w, -r0.w, l(1.000000)
log r0.w, r0.w
mul r0.w, r0.w, cb4[4].w
exp r0.w, r0.w
add r1.w, -cb4[5].x, cb4[5].y
mad r0.w, r0.w, r1.w, cb4[5].x
sample r2.xyzw, v2.xyxx, t2.xyzw, s2
add r0.w, r0.w, r2.w
mul r1.xyz, r1.xyzx, r0.wwww
mad o0.xyz, r2.xyzx, r0.xyzx, r1.xyzx
mov o0.w, l(1.000000)
ret 
// Approximately 59 instruction slots used

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