//sun glow and Lights shafts
// ---- Created with 3Dmigoto v0.6.164 on Tue Jan  6 09:39:40 2026
Texture2D<float4> t3 : register(t3);

Texture3D<float4> t2 : register(t2);

Texture2D<float4> t1 : register(t1);

Texture2D<float4> t0 : register(t0);

SamplerComparisonState s3_s : register(s3);

SamplerState s2_s : register(s2);

SamplerState s1_s : register(s1);

SamplerState s0_s : register(s0);

cbuffer cb3 : register(b3)
{
  float4 cb3[22];
}

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

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

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




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


void main(
  float4 v0 : SV_POSITION0,
  float4 v1 : TEXCOORD0,
  float4 v2 : TEXCOORD1,
  float4 v3 : TEXCOORD2,
  out float4 o0 : SV_Target0)
{
  float4 r0,r1,r2,r3,r4,r5,r6,r7,r8,r9,r10,r20;
  uint4 bitmask, uiDest;
  float4 fDest;
  
float4 s = StereoParams.Load(0);
float4 testeo = IniParams.Load(int2(90,0));  
r20 = v1;
r20.x -= s.x * 0.5;  

  r0.xy = v1.xy * cb0[12].xy + cb0[12].zw;
  r0.xyzw = t0.Sample(s0_s, r0.xy).yzxw;
  if (cb3[21].x == 0) {
    r1.x = cb0[37].x;
    r1.y = cb0[38].x;
    r1.z = cb0[39].x;
    r1.w = cb0[40].x;
    r2.x = cb0[37].y;
    r2.y = cb0[38].y;
    r2.z = cb0[39].y;
    r2.w = cb0[40].y;
    r3.x = cb0[37].z;
    r3.y = cb0[38].z;
    r3.z = cb0[39].z;
    r3.w = cb0[40].z;
    r4.x = cb0[37].w;
    r4.y = cb0[38].w;
    r4.z = cb0[39].w;
    r4.w = cb0[40].w;
    r5.x = cb0[29].x;
    r5.y = cb0[30].x;
    r5.z = cb0[31].x;
    r5.w = cb0[32].x;
    r6.x = cb0[29].y;
    r6.y = cb0[30].y;
    r6.z = cb0[31].y;
    r6.w = cb0[32].y;
    r7.x = cb0[29].z;
    r7.y = cb0[30].z;
    r7.z = cb0[31].z;
    r7.w = cb0[32].z;
  } else {
    r1.x = cb0[41].x;
    r1.y = cb0[42].x;
    r1.z = cb0[43].x;
    r1.w = cb0[44].x;
    r2.x = cb0[41].y;
    r2.y = cb0[42].y;
    r2.z = cb0[43].y;
    r2.w = cb0[44].y;
    r3.x = cb0[41].z;
    r3.y = cb0[42].z;
    r3.z = cb0[43].z;
    r3.w = cb0[44].z;
    r4.x = cb0[41].w;
    r4.y = cb0[42].w;
    r4.z = cb0[43].w;
    r4.w = cb0[44].w;
    r5.x = cb0[33].x;
    r5.y = cb0[34].x;
    r5.z = cb0[35].x;
    r5.w = cb0[36].x;
    r6.x = cb0[33].y;
    r6.y = cb0[34].y;
    r6.z = cb0[35].y;
    r6.w = cb0[36].y;
    r7.x = cb0[33].z;
    r7.y = cb0[34].z;
    r7.z = cb0[35].z;
    r7.w = cb0[36].z;
  }
  //r0.xy = v1.xy * float2(2,2) + float2(-1,-1);
  
r0.xy = r20.xy * float2(2,2) + float2(-1,-1);  //SUN
  
  r0.w = 1;
  r1.x = dot(r1.xyzw, r0.xyzw);
  r1.y = dot(r2.xyzw, r0.xyzw);
  r1.z = dot(r3.xyzw, r0.xyzw);
  r1.w = dot(r4.xyzw, r0.xyzw);
  r1.xyzw = r1.xyzw / r1.wwww;
  r2.x = dot(r5.xyzw, r1.xyzw);
  r2.y = dot(r6.xyzw, r1.xyzw);
  r2.z = dot(r7.xyzw, r1.xyzw);
  r0.x = cb1[7].x * r0.z + cb1[7].y;
  r0.x = 1 / r0.x;
  r0.yzw = -cb1[4].xyz + r2.xyz;
  r1.x = dot(r0.yzw, r0.yzw);
  r1.x = sqrt(r1.x);
  r0.yzw = r0.yzw / r1.xxx;
  r1.x = min(cb0[48].x, r1.x);
  r1.yz = floor(v0.xy);
  r1.yz = float2(0.125,0.125) * r1.yz;
  r2.xy = cmp(r1.yz >= -r1.yz);
  r1.yz = frac(abs(r1.yz));
  r1.yz = r2.xy ? r1.yz : -r1.yz;
  r1.yz = float2(0.0625,0.0625) + r1.yz;
  r2.xyzw = t1.Sample(s2_s, r1.yz).xyzw;
  r1.y = asint(cb0[48].y);
  r1.x = r1.x / r1.y;
  r1.yzw = r1.xxx * r0.yzw;
  r1.yzw = r1.yzw * r2.www + cb1[4].xyz;
  r2.x = dot(cb0[3].xyz, -r0.yzw);
  r2.y = 1 + -cb2[24].x;
  r3.xz = cb1[0].yy * cb0[50].xy;
  r2.zw = cb0[46].xy * r1.xx;
  r3.y = 0;
  r5.xyz = r1.yzw;
  r3.w = 0;
  r4.xyzw = float4(0,0,0,0);
  while (true) {
    r5.w = cmp((int)r4.w >= asint(cb0[48].y));
    if (r5.w != 0) break;
    r6.xyz = -cb2[0].xyz + r5.xyz;
    r7.xyz = -cb2[1].xyz + r5.xyz;
    r8.xyz = -cb2[2].xyz + r5.xyz;
    r9.xyz = -cb2[3].xyz + r5.xyz;
    r6.x = dot(r6.xyz, r6.xyz);
    r6.y = dot(r7.xyz, r7.xyz);
    r6.z = dot(r8.xyz, r8.xyz);
    r6.w = dot(r9.xyz, r9.xyz);
    r6.xyzw = cmp(r6.xyzw < cb2[4].xyzw);
    r7.xyzw = r6.xyzw ? float4(1,1,1,1) : 0;
    r6.xyz = r6.xyz ? float3(-1,-1,-1) : float3(-0,-0,-0);
    r6.xyz = r7.yzw + r6.xyz;
    r7.yzw = max(float3(0,0,0), r6.xyz);
    r5.w = dot(r7.xyzw, float4(1,1,1,1));
    r6.x = cmp(r5.w < 4);
    r6.yzw = cb2[9].xyz * r5.yyy;
    r6.yzw = cb2[8].xyz * r5.xxx + r6.yzw;
    r6.yzw = cb2[10].xyz * r5.zzz + r6.yzw;
    r6.yzw = cb2[11].xyz + r6.yzw;
    r8.xyz = cb2[13].xyz * r5.yyy;
    r8.xyz = cb2[12].xyz * r5.xxx + r8.xyz;
    r8.xyz = cb2[14].xyz * r5.zzz + r8.xyz;
    r8.xyz = cb2[15].xyz + r8.xyz;
    r9.xyz = cb2[17].xyz * r5.yyy;
    r9.xyz = cb2[16].xyz * r5.xxx + r9.xyz;
    r9.xyz = cb2[18].xyz * r5.zzz + r9.xyz;
    r9.xyz = cb2[19].xyz + r9.xyz;
    r10.xyz = cb2[21].xyz * r5.yyy;
    r10.xyz = cb2[20].xyz * r5.xxx + r10.xyz;
    r10.xyz = cb2[22].xyz * r5.zzz + r10.xyz;
    r10.xyz = cb2[23].xyz + r10.xyz;
    r8.xyz = r8.xyz * r7.yyy;
    r6.yzw = r6.yzw * r7.xxx + r8.xyz;
    r6.yzw = r9.xyz * r7.zzz + r6.yzw;
    r6.yzw = r10.xyz * r7.www + r6.yzw;
    r5.w = r6.w + -r5.w;
    r5.w = 1 + r5.w;
    r5.w = t3.SampleCmpLevelZero(s3_s, r6.yz, r5.w).x;
    r5.w = r6.x ? r5.w : 1;
    r5.w = r5.w * r2.y + cb2[24].x;
    r6.xyz = r5.xyz * cb0[49].xxx + r3.xyz;
    r6.xyz = frac(r6.xyz);
    r6.xyzw = t2.Sample(s1_s, r6.xyz).xyzw;
    r6.x = saturate(-cb0[49].z + r6.x);
    r6.x = saturate(cb0[49].y * r6.x);
    r6.x = 0.100000001 * r6.x;
    r6.y = r6.x * r2.z;
    r3.w = r2.w * r6.x + r3.w;
    r5.w = r6.y * r5.w;
    r6.x = -1.44269502 * r3.w;
    r6.x = exp2(r6.x);
    r4.xyz = r5.www * r6.xxx + r4.xyz;
    r5.xyz = r0.yzw * r1.xxx + r5.xyz;
    r4.w = (int)r4.w + 1;
  }
  r0.y = -cb0[47].z * r2.x + cb0[47].y;
  r0.y = log2(r0.y);
  r0.y = 1.5 * r0.y;
  r0.y = exp2(r0.y);
  r0.y = cb0[47].x / r0.y;
  r0.y = cb0[47].w * r0.y;
  r0.yzw = r4.xyz * r0.yyy;
  r0.yzw = cb0[5].xyz * r0.yzw;
  o0.xyz = max(float3(0,0,0), r0.yzw);
  r0.y = -1.44269502 * r3.w;
  r0.y = exp2(r0.y);
  r0.x = cmp(0.999998987 < r0.x);
  r0.z = 1 + -r0.y;
  r0.z = cb0[46].w * r0.z + r0.y;
  o0.w = r0.x ? r0.z : r0.y;
  return;
}

/*~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
//
// Generated by Microsoft (R) D3D Shader Disassembler
//
//   using 3Dmigoto v0.6.164 on Tue Jan  6 09:39:40 2026
//
//
// Input signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_POSITION              0   xyzw        0      POS   float   xy
// TEXCOORD                 0   xyzw        1     NONE   float   xy
// TEXCOORD                 1   xyz         2     NONE   float
// TEXCOORD                 2   xyzw        3     NONE   float
//
//
// Output signature:
//
// Name                 Index   Mask Register SysValue  Format   Used
// -------------------- ----- ------ -------- -------- ------- ------
// SV_Target                0   xyzw        0   TARGET   float   xyzw
//
ps_4_0
dcl_constantbuffer CB0[51], immediateIndexed
dcl_constantbuffer CB1[8], immediateIndexed
dcl_constantbuffer CB2[25], immediateIndexed
dcl_constantbuffer CB3[22], immediateIndexed
dcl_sampler s0, mode_default
dcl_sampler s1, mode_default
dcl_sampler s2, mode_default
dcl_sampler s3, mode_comparison
dcl_resource_texture2d (float,float,float,float) t0
dcl_resource_texture2d (float,float,float,float) t1
dcl_resource_texture3d (float,float,float,float) t2
dcl_resource_texture2d (float,float,float,float) t3
dcl_input_ps_siv linear noperspective v0.xy, position
dcl_input_ps linear v1.xy
dcl_output o0.xyzw
dcl_temps 11
mad r0.xy, v1.xyxx, cb0[12].xyxx, cb0[12].zwzz
sample r0.xyzw, r0.xyxx, t0.yzxw, s0
if_z cb3[21].x
  mov r1.x, cb0[37].x
  mov r1.y, cb0[38].x
  mov r1.z, cb0[39].x
  mov r1.w, cb0[40].x
  mov r2.x, cb0[37].y
  mov r2.y, cb0[38].y
  mov r2.z, cb0[39].y
  mov r2.w, cb0[40].y
  mov r3.x, cb0[37].z
  mov r3.y, cb0[38].z
  mov r3.z, cb0[39].z
  mov r3.w, cb0[40].z
  mov r4.x, cb0[37].w
  mov r4.y, cb0[38].w
  mov r4.z, cb0[39].w
  mov r4.w, cb0[40].w
  mov r5.x, cb0[29].x
  mov r5.y, cb0[30].x
  mov r5.z, cb0[31].x
  mov r5.w, cb0[32].x
  mov r6.x, cb0[29].y
  mov r6.y, cb0[30].y
  mov r6.z, cb0[31].y
  mov r6.w, cb0[32].y
  mov r7.x, cb0[29].z
  mov r7.y, cb0[30].z
  mov r7.z, cb0[31].z
  mov r7.w, cb0[32].z
else
  mov r1.x, cb0[41].x
  mov r1.y, cb0[42].x
  mov r1.z, cb0[43].x
  mov r1.w, cb0[44].x
  mov r2.x, cb0[41].y
  mov r2.y, cb0[42].y
  mov r2.z, cb0[43].y
  mov r2.w, cb0[44].y
  mov r3.x, cb0[41].z
  mov r3.y, cb0[42].z
  mov r3.z, cb0[43].z
  mov r3.w, cb0[44].z
  mov r4.x, cb0[41].w
  mov r4.y, cb0[42].w
  mov r4.z, cb0[43].w
  mov r4.w, cb0[44].w
  mov r5.x, cb0[33].x
  mov r5.y, cb0[34].x
  mov r5.z, cb0[35].x
  mov r5.w, cb0[36].x
  mov r6.x, cb0[33].y
  mov r6.y, cb0[34].y
  mov r6.z, cb0[35].y
  mov r6.w, cb0[36].y
  mov r7.x, cb0[33].z
  mov r7.y, cb0[34].z
  mov r7.z, cb0[35].z
  mov r7.w, cb0[36].z
endif
mad r0.xy, v1.xyxx, l(2.000000, 2.000000, 0.000000, 0.000000), l(-1.000000, -1.000000, 0.000000, 0.000000)
mov r0.w, l(1.000000)
dp4 r1.x, r1.xyzw, r0.xyzw
dp4 r1.y, r2.xyzw, r0.xyzw
dp4 r1.z, r3.xyzw, r0.xyzw
dp4 r1.w, r4.xyzw, r0.xyzw
div r1.xyzw, r1.xyzw, r1.wwww
dp4 r2.x, r5.xyzw, r1.xyzw
dp4 r2.y, r6.xyzw, r1.xyzw
dp4 r2.z, r7.xyzw, r1.xyzw
mad r0.x, cb1[7].x, r0.z, cb1[7].y
div r0.x, l(1.000000, 1.000000, 1.000000, 1.000000), r0.x
add r0.yzw, r2.xxyz, -cb1[4].xxyz
dp3 r1.x, r0.yzwy, r0.yzwy
sqrt r1.x, r1.x
div r0.yzw, r0.yyzw, r1.xxxx
min r1.x, r1.x, cb0[48].x
round_ni r1.yz, v0.xxyx
mul r1.yz, r1.yyzy, l(0.000000, 0.125000, 0.125000, 0.000000)
ge r2.xy, r1.yzyy, -r1.yzyy
frc r1.yz, |r1.yyzy|
movc r1.yz, r2.xxyx, r1.yyzy, -r1.yyzy
add r1.yz, r1.yyzy, l(0.000000, 0.062500, 0.062500, 0.000000)
sample r2.xyzw, r1.yzyy, t1.xyzw, s2
itof r1.y, cb0[48].y
div r1.x, r1.x, r1.y
mul r1.yzw, r0.yyzw, r1.xxxx
mad r1.yzw, r1.yyzw, r2.wwww, cb1[4].xxyz
dp3 r2.x, cb0[3].xyzx, -r0.yzwy
add r2.y, -cb2[24].x, l(1.000000)
mul r3.xz, cb0[50].xxyx, cb1[0].yyyy
mul r2.zw, r1.xxxx, cb0[46].xxxy
mov r3.y, l(0)
mov r5.xyz, r1.yzwy
mov r3.w, l(0)
mov r4.xyzw, l(0,0,0,0)
loop
  ige r5.w, r4.w, cb0[48].y
  breakc_nz r5.w
  add r6.xyz, r5.xyzx, -cb2[0].xyzx
  add r7.xyz, r5.xyzx, -cb2[1].xyzx
  add r8.xyz, r5.xyzx, -cb2[2].xyzx
  add r9.xyz, r5.xyzx, -cb2[3].xyzx
  dp3 r6.x, r6.xyzx, r6.xyzx
  dp3 r6.y, r7.xyzx, r7.xyzx
  dp3 r6.z, r8.xyzx, r8.xyzx
  dp3 r6.w, r9.xyzx, r9.xyzx
  lt r6.xyzw, r6.xyzw, cb2[4].xyzw
  and r7.xyzw, r6.xyzw, l(0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000)
  movc r6.xyz, r6.xyzx, l(-1.000000,-1.000000,-1.000000,0), l(-0.000000,-0.000000,-0.000000,0)
  add r6.xyz, r6.xyzx, r7.yzwy
  max r7.yzw, r6.xxyz, l(0.000000, 0.000000, 0.000000, 0.000000)
  dp4 r5.w, r7.xyzw, l(1.000000, 1.000000, 1.000000, 1.000000)
  lt r6.x, r5.w, l(4.000000)
  mul r6.yzw, r5.yyyy, cb2[9].xxyz
  mad r6.yzw, cb2[8].xxyz, r5.xxxx, r6.yyzw
  mad r6.yzw, cb2[10].xxyz, r5.zzzz, r6.yyzw
  add r6.yzw, r6.yyzw, cb2[11].xxyz
  mul r8.xyz, r5.yyyy, cb2[13].xyzx
  mad r8.xyz, cb2[12].xyzx, r5.xxxx, r8.xyzx
  mad r8.xyz, cb2[14].xyzx, r5.zzzz, r8.xyzx
  add r8.xyz, r8.xyzx, cb2[15].xyzx
  mul r9.xyz, r5.yyyy, cb2[17].xyzx
  mad r9.xyz, cb2[16].xyzx, r5.xxxx, r9.xyzx
  mad r9.xyz, cb2[18].xyzx, r5.zzzz, r9.xyzx
  add r9.xyz, r9.xyzx, cb2[19].xyzx
  mul r10.xyz, r5.yyyy, cb2[21].xyzx
  mad r10.xyz, cb2[20].xyzx, r5.xxxx, r10.xyzx
  mad r10.xyz, cb2[22].xyzx, r5.zzzz, r10.xyzx
  add r10.xyz, r10.xyzx, cb2[23].xyzx
  mul r8.xyz, r7.yyyy, r8.xyzx
  mad r6.yzw, r6.yyzw, r7.xxxx, r8.xxyz
  mad r6.yzw, r9.xxyz, r7.zzzz, r6.yyzw
  mad r6.yzw, r10.xxyz, r7.wwww, r6.yyzw
  add r5.w, -r5.w, r6.w
  add r5.w, r5.w, l(1.000000)
  sample_c_lz r5.w, r6.yzyy, t3.xxxx, s3, r5.w
  movc r5.w, r6.x, r5.w, l(1.000000)
  mad r5.w, r5.w, r2.y, cb2[24].x
  mad r6.xyz, r5.xyzx, cb0[49].xxxx, r3.xyzx
  frc r6.xyz, r6.xyzx
  sample r6.xyzw, r6.xyzx, t2.xyzw, s1
  add_sat r6.x, r6.x, -cb0[49].z
  mul_sat r6.x, r6.x, cb0[49].y
  mul r6.x, r6.x, l(0.100000)
  mul r6.y, r2.z, r6.x
  mad r3.w, r2.w, r6.x, r3.w
  mul r5.w, r5.w, r6.y
  mul r6.x, r3.w, l(-1.442695)
  exp r6.x, r6.x
  mad r4.xyz, r5.wwww, r6.xxxx, r4.xyzx
  mad r5.xyz, r0.yzwy, r1.xxxx, r5.xyzx
  iadd r4.w, r4.w, l(1)
endloop
mad r0.y, -cb0[47].z, r2.x, cb0[47].y
log r0.y, r0.y
mul r0.y, r0.y, l(1.500000)
exp r0.y, r0.y
div r0.y, cb0[47].x, r0.y
mul r0.y, r0.y, cb0[47].w
mul r0.yzw, r0.yyyy, r4.xxyz
mul r0.yzw, r0.yyzw, cb0[5].xxyz
max o0.xyz, r0.yzwy, l(0.000000, 0.000000, 0.000000, 0.000000)
mul r0.y, r3.w, l(-1.442695)
exp r0.y, r0.y
lt r0.x, l(0.999999), r0.x
add r0.z, -r0.y, l(1.000000)
mad r0.z, cb0[46].w, r0.z, r0.y
movc o0.w, r0.x, r0.z, r0.y
ret
// Approximately 0 instruction slots used

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