// decrease opacity map more transparent map right top corner
// ---- Created with 3Dmigoto v1.3.16 on Fri Oct 04 11:30:21 2019
Texture2D<float4> t3 : register(t3);

Texture2D<float4> t2 : register(t2);

Texture2D<float4> t1 : register(t1);

Texture2D<float4> t0 : register(t0);

SamplerState s3_s : register(s3);

SamplerState s2_s : register(s2);

SamplerState s1_s : register(s1);

SamplerState s0_s : register(s0);

cbuffer cb2 : register(b2)
{
  float4 cb2[3];
}

cbuffer cb1 : register(b1)
{
  float4 cb1[128];
}

cbuffer cb0 : register(b0)
{
  float4 cb0[3];
}




// 3Dmigoto declarations
#define cmp -
Texture1D<float4> IniParams : register(t120);
Texture2D<float4> StereoParams : register(t125);


void main(
  float4 v0 : SV_POSITION0,
  float4 v1 : COLOR0,
  float4 v2 : ORIGINAL_POSITION0,
  float4 v3 : TEXCOORD0,
  float4 v4 : TEXCOORD1,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1,r2,r3;
  uint4 bitmask, uiDest;
  float4 fDest;

  r0.xy = v4.xy * v4.zw;
  r0.zw = cb1[127].zz * float2(0.200000003,0.200000003) + r0.xy;
  r0.z = t2.Sample(s2_s, r0.zw).x;
  r0.zw = r0.zz * float2(0.0799999982,0.0799999982) + r0.xy;
  r0.z = t1.Sample(s1_s, r0.zw).x;
  r1.xy = float2(0.0799999982,0.0199999996) * cb1[127].zz;
  r1.xy = r0.xy * float2(0.5,0.5) + r1.xy;
  r0.w = t1.Sample(s1_s, r1.xy).x;
  r0.w = 0.5 * r0.w;
  r0.z = r0.z * r0.w;
  r0.z = cb2[2].x * r0.z;
  r1.xyz = t0.Sample(s0_s, r0.xy).xyz;
  r2.w = t3.Sample(s3_s, r0.xy).x;
  r2.w = saturate(r2.w);
  r0.xyz = r0.zzz * float3(0.0416666716,0.0375435688,0.0376777202) + -r1.xyz;
  r0.w = dot(r1.xyz, r1.xyz);
  r0.w = sqrt(r0.w);
  r0.w = -r0.w * 10 + 1;
  r0.w = max(0, r0.w);
  r0.xyz = r0.www * r0.xyz + r1.xyz;
  r0.xyz = cb2[1].xyz + r0.xyz;
  r2.xyz = max(float3(0,0,0), r0.xyz);
  r0.xyzw = v1.xyzw * r2.xyzw;
  r1.xyz = log2(r0.xyz);
  r1.xyz = cb0[2].xxx * r1.xyz;
  r2.xyz = float3(0.416666657,0.416666657,0.416666657) * r1.xyz;
  r1.xyz = exp2(r1.xyz);
  r2.xyz = exp2(r2.xyz);
  r2.xyz = r2.xyz * float3(1.05499995,1.05499995,1.05499995) + float3(-0.0549999997,-0.0549999997,-0.0549999997);
  r3.xyz = float3(12.9200001,12.9200001,12.9200001) * r1.xyz;
  r1.xyz = cmp(r1.xyz >= float3(0.00313066994,0.00313066994,0.00313066994));
  r1.xyz = r1.xyz ? r2.xyz : r3.xyz;
  r1.w = cmp(cb0[2].y != 1.000000);
  o0.xyz = r1.www ? r1.xyz : r0.xyz;
  o0.w = 0.3;
  return;
}
