112Shaders/rain.fx
2021-12-28 10:06:46 +01:00

466 lines
14 KiB
HLSL

string DefaultParameterScopeBlock = "material"; // 1
float3 AmbientLightColor <bool unmanaged = 1;> = { 0.3, 0.3, 0.3 };
struct {
float3 Color;
float3 Direction;
} DirectionalLight[3] <bool unmanaged = 1;> = { 1.625198, 1.512711, 1.097048, 0.62914, -0.34874, 0.69465, 0.5232916, 0.6654605, 0.7815244, -0.32877, 0.90329, 0.27563, 0.4420466, 0.4102767, 0.4420466, -0.80704, -0.58635, 0.06975 };
struct {
float3 Color;
float3 Position;
float2 Range_Inner_Outer;
} PointLight[8] <bool unmanaged = 1;>;
struct {
float4 WorldPositionMultiplier_XYZZ;
float2 CurrentOffsetUV;
} Cloud <bool unmanaged = 1;>;
float3 NoCloudMultiplier <bool unmanaged = 1;> = { 1, 1, 1 };
float3 RecolorColorDummy <bool unmanaged = 1;>;
row_major float4x4 ShadowMapWorldToShadow <bool unmanaged = 1;>;
float OpacityOverride <bool unmanaged = 1;> = { 1 };
float3 TintColor <bool unmanaged = 1;> = { 1, 1, 1 };
float3 EyePosition <bool unmanaged = 1;>;
row_major float4x4 ViewProjection <bool unmanaged = 1;>;
float4 WorldBones[128] <bool unmanaged = 1;>;
column_major float4x4 World : World : register(vs_2_0, c20);
column_major float4x4 View : View : register(vs_2_0, c23);
column_major float4x3 ViewInverse : ViewInverse : register(vs_2_0, c26);
column_major float4x4 Projection : Projection : register(vs_2_0, c16);
float Time : Time : register(vs_2_0, c28);
float RainBoxHeight : register(vs_2_0, c29) <string UIName = "Rain Box Width"; float UIMin = 0; float UIMax = 10000;> = { 200 };
float MinWidth : register(vs_2_0, c30) <string UIName = "Min Width"; float UIMin = 0; float UIMax = 10000;> = { 0.5 };
float MaxWidth <string UIName = "Max Width"; float UIMin = 0; float UIMax = 10000;> = { 1.5 };
float MinHeight : register(vs_2_0, c31) <string UIName = "Min Height"; float UIMin = 0; float UIMax = 10000;> = { 5 };
float MaxHeight <string UIName = "Max Height"; float UIMin = 0; float UIMax = 10000;> = { 15 };
float MinSpeed : register(vs_2_0, c32) <string UIName = "Min Speed"; float UIMin = 0; float UIMax = 10000;> = { 50 };
float MaxSpeed <string UIName = "Max Speed"; float UIMin = 0; float UIMax = 10000;> = { 150 };
float MinAlpha : register(vs_2_0, c33) <string UIName = "Min Alpha"; float UIMin = 0; float UIMax = 1;> = { 0.1 };
float MaxAlpha <string UIName = "Max Alpha"; float UIMin = 0; float UIMax = 1;> = { 0.5 };
float WindStrength <string UIName = "Wind Strength"; float UIMin = 0; float UIMax = 10000;> = { 1 };
texture DiffuseTexture <string UIName = "Diffuse Texture";>; // 12
sampler2D DiffuseTextureSampler : register(ps_2_0, s0) <string Texture = "DiffuseTexture"; string UIName = "Diffuse Texture";> =
sampler_state
{
Texture = <DiffuseTexture>; // 14
MinFilter = 2;
MagFilter = 2;
MipFilter = 2;
AddressU = 1;
AddressV = 1;
};
struct
{
float4 ScaleUV_OffsetUV;
} Shroud : register(vs_2_0, c34) <string UIWidget = "None"; string SasBindAddress = "Terrain.Shroud";> = { 1, 1, 0, 0 };
texture ShroudTexture <string UIWidget = "None"; string SasBindAddress = "Terrain.Shroud.Texture"; string ResourceName = "ShaderPreviewShroud.dds";>; // 19
sampler2D ShroudTextureSampler : register(ps_2_0, s1) <string Texture = "ShroudTexture"; string UIWidget = "None"; string SasBindAddress = "Terrain.Shroud.Texture"; string ResourceName = "ShaderPreviewShroud.dds";> =
sampler_state
{
Texture = <ShroudTexture>; // 23
MinFilter = 2;
MagFilter = 2;
MipFilter = 2;
AddressU = 3;
AddressV = 3;
};
// Default_M_PixelShader1 Pixel_2_0 Has PRES False
struct Default_M_PixelShader1_Input
{
float4 color : COLOR;
float2 texcoord : TEXCOORD;
float2 texcoord1 : TEXCOORD1;
};
float4 Default_M_PixelShader1(Default_M_PixelShader1_Input i) : COLOR
{
float4 out_color;
float4 temp0, temp1;
// dcl v0
// dcl t0.xy
// dcl t1.xy
// dcl_2d s0
// dcl_2d s1
// texld r0, t1, s1
temp0 = tex2D(ShroudTextureSampler, i.texcoord1.xy);
// texld r1, t0, s0
temp1 = tex2D(DiffuseTextureSampler, i.texcoord.xy);
// mul r1, r1, v0
temp1 = temp1 * i.color;
// mul r1.w, r0.x, r1.w
temp1.w = temp0.x * temp1.w;
// mov oC0, r1
out_color = temp1;
//
return out_color;
}
// Default_M_VertexShader2 Vertex_2_0 Has PRES True
struct Default_M_VertexShader2_Input
{
float4 position : POSITION;
float4 color : COLOR;
float4 texcoord : TEXCOORD;
};
struct Default_M_VertexShader2_Output
{
float4 color : COLOR;
float4 position : POSITION;
float2 texcoord1 : TEXCOORD1;
float2 texcoord : TEXCOORD;
};
Default_M_VertexShader2_Output Default_M_VertexShader2(Default_M_VertexShader2_Input i)
{
/*
PRSI
OutputRegisterOffset: 11
Unknown1: 0
Unknown2: 0
OutputRegisterCount: 5
Unknown3: 0
Unknown4: 0
Unknown5: 11
Unknown6: 5
Mappings: 1
0 - ConstOutput: 0 ConstInput 0
*/
float4 expr11;
float4 expr12;
float4 expr13;
float4 expr14;
float4 expr15;
{
float4 temp0;
// Expression_2_1
// neg r0.x, c1.x
temp0.x = -MinWidth.x;
// add c11.x, r0.x, c2.x
expr11.x = temp0.x + MaxWidth.x;
// neg r0.x, c3.x
temp0.x = -MinHeight.x;
// add c12.x, r0.x, c4.x
expr12.x = temp0.x + MaxHeight.x;
// neg r0.x, c5.x
temp0.x = -MinSpeed.x;
// add c13.x, r0.x, c6.x
expr13.x = temp0.x + MaxSpeed.x;
// neg r0.x, c7.x
temp0.x = -MinAlpha.x;
// add c14.x, r0.x, c8.x
expr14.x = temp0.x + MaxAlpha.x;
// rcp c15.x, c0.x
expr15.x = 1.0f / (RainBoxHeight.x);
}
Default_M_VertexShader2_Output o;
float4 temp0, temp1, temp2;
// def c0, 1, 0, -0.5, 0
// dcl_position v0
// dcl_color v1
// dcl_texcoord v2
// mov r0.x, c14.x
temp0.x = expr14.x;
// mad oD0.w, v1.w, r0.x, c33.x
o.color.w = i.color.w * temp0.x + MinAlpha.x;
// mov r0.x, c11.x
temp0.x = expr11.x;
// mad r0.y, v1.x, r0.x, c30.x
temp0.y = i.color.x * temp0.x + MinWidth.x;
// mov r1.x, c12.x
temp1.x = expr12.x;
// mad r0.x, v1.y, r1.x, c31.x
temp0.x = i.color.y * temp1.x + MinHeight.x;
// mul r0.xy, r0, v2.yxzw
temp0.xy = temp0.xy * i.texcoord.yx;
// mov r1.x, c13.x
temp1.x = expr13.x;
// mad r0.z, v1.z, r1.x, c32.x
temp0.z = i.color.z * temp1.x + MinSpeed.x;
// mad r1, v0.xyzx, c0.xxxy, c0.yyyx
temp1 = i.position.xyzx * float4(1, 1, 1, 0) + float4(0, 0, 0, 1);
// dp4 r0.w, r1, c22
temp0.w = dot(temp1, (World._m02_m12_m22_m32));
// mad r0.z, r0.z, -c28.x, r0.w
temp0.z = temp0.z * -Time.x + temp0.w;
// mul r0.z, r0.z, c15.x
temp0.z = temp0.z * expr15.x;
// abs r0.w, r0.z
temp0.w = abs(temp0.z);
// sge r0.z, r0.z, -r0.z
temp0.z = (temp0.z >= -temp0.z) ? 1 : 0;
// frc r0.w, r0.w
temp0.w = frac(temp0.w);
// lrp r2.x, r0.z, r0.w, -r0.w
temp2.x = lerp(-temp0.w, temp0.w, temp0.z);
// mad r0.z, r2.x, c29.x, c29.x
temp0.z = temp2.x * RainBoxHeight.x + RainBoxHeight.x;
// mad r2.z, r0.x, c0.z, r0.z
temp2.z = temp0.x * float1(-0.5) + temp0.z;
// mov r2.w, c0.x
temp2.w = float1(1);
// dp4 r2.x, r1, c20
temp2.x = dot(temp1, (World._m00_m10_m20_m30));
// dp4 r2.y, r1, c21
temp2.y = dot(temp1, (World._m01_m11_m21_m31));
// dp4 r0.x, r2, c23
temp0.x = dot(temp2, (View._m00_m10_m20_m30));
// mad r0.x, r0.y, c0.z, r0.x
temp0.x = temp0.y * float1(-0.5) + temp0.x;
// dp4 r0.y, r2, c24
temp0.y = dot(temp2, (View._m01_m11_m21_m31));
// dp4 r0.z, r2, c25
temp0.z = dot(temp2, (View._m02_m12_m22_m32));
// mov r0.w, c0.x
temp0.w = float1(1);
// dp4 oPos.x, r0, c16
o.position.x = dot(temp0, (Projection._m00_m10_m20_m30));
// dp4 oPos.y, r0, c17
o.position.y = dot(temp0, (Projection._m01_m11_m21_m31));
// dp4 oPos.z, r0, c18
o.position.z = dot(temp0, (Projection._m02_m12_m22_m32));
// dp4 oPos.w, r0, c19
o.position.w = dot(temp0, (Projection._m03_m13_m23_m33));
// dp4 r1.x, r0, c26
temp1.x = dot(temp0, (ViewInverse._m00_m10_m20_m30));
// dp4 r1.y, r0, c27
temp1.y = dot(temp0, (ViewInverse._m01_m11_m21_m31));
// add r0.xy, r1, c34.zwzw
temp0.xy = temp1.xy + Shroud.ScaleUV_OffsetUV.zw;
// mul oT1.xy, r0, c34
o.texcoord1 = temp0 * Shroud.ScaleUV_OffsetUV;
// mov oD0.xyz, c0.x
o.color.xyz = float3(1, 1, 1);
// mov oT0.xy, v2
o.texcoord = i.texcoord;
//
return o;
}
// Default_PixelShader3 Pixel_2_0 Has PRES False
struct Default_PixelShader3_Input
{
float4 color : COLOR;
float2 texcoord : TEXCOORD;
float2 texcoord1 : TEXCOORD1;
};
float4 Default_PixelShader3(Default_PixelShader3_Input i) : COLOR
{
float4 out_color;
float4 temp0, temp1;
// def c0, 2.2, 0, 0, 0
// dcl v0
// dcl t0.xy
// dcl t1.xy
// dcl_2d s0
// dcl_2d s1
// texld r0, t0, s0
temp0 = tex2D(DiffuseTextureSampler, i.texcoord.xy);
// texld r1, t1, s1
temp1 = tex2D(ShroudTextureSampler, i.texcoord1.xy);
// log r1.w, r0.x
temp1.w = log2(temp0.x);
// log r1.z, r0.y
temp1.z = log2(temp0.y);
// log r1.y, r0.z
temp1.y = log2(temp0.z);
// mul r1.yzw, r1, c0.x
temp1.yzw = temp1.yzw * float3(2.2, 2.2, 2.2);
// exp r0.x, r1.w
temp0.x = exp2(temp1.w);
// exp r0.y, r1.z
temp0.y = exp2(temp1.z);
// exp r0.z, r1.y
temp0.z = exp2(temp1.y);
// mul r0, r0, v0
temp0 = temp0 * i.color;
// mul r0.w, r1.x, r0.w
temp0.w = temp1.x * temp0.w;
// mov oC0, r0
out_color = temp0;
//
return out_color;
}
// Default_VertexShader4 Vertex_2_0 Has PRES True
struct Default_VertexShader4_Input
{
float4 position : POSITION;
float4 color : COLOR;
float4 texcoord : TEXCOORD;
};
struct Default_VertexShader4_Output
{
float4 color : COLOR;
float4 position : POSITION;
float2 texcoord1 : TEXCOORD1;
float2 texcoord : TEXCOORD;
};
Default_VertexShader4_Output Default_VertexShader4(Default_VertexShader4_Input i)
{
/*
PRSI
OutputRegisterOffset: 11
Unknown1: 0
Unknown2: 0
OutputRegisterCount: 5
Unknown3: 0
Unknown4: 0
Unknown5: 11
Unknown6: 5
Mappings: 1
0 - ConstOutput: 0 ConstInput 0
*/
float4 expr11;
float4 expr12;
float4 expr13;
float4 expr14;
float4 expr15;
{
float4 temp0;
// Expression_2_1
// neg r0.x, c1.x
temp0.x = -MinWidth.x;
// add c11.x, r0.x, c2.x
expr11.x = temp0.x + MaxWidth.x;
// neg r0.x, c3.x
temp0.x = -MinHeight.x;
// add c12.x, r0.x, c4.x
expr12.x = temp0.x + MaxHeight.x;
// neg r0.x, c5.x
temp0.x = -MinSpeed.x;
// add c13.x, r0.x, c6.x
expr13.x = temp0.x + MaxSpeed.x;
// neg r0.x, c7.x
temp0.x = -MinAlpha.x;
// add c14.x, r0.x, c8.x
expr14.x = temp0.x + MaxAlpha.x;
// rcp c15.x, c0.x
expr15.x = 1.0f / (RainBoxHeight.x);
}
Default_VertexShader4_Output o;
float4 temp0, temp1, temp2;
// def c0, 1, 0, -0.5, 0
// dcl_position v0
// dcl_color v1
// dcl_texcoord v2
// mov r0.x, c14.x
temp0.x = expr14.x;
// mad oD0.w, v1.w, r0.x, c33.x
o.color.w = i.color.w * temp0.x + MinAlpha.x;
// mov r0.x, c11.x
temp0.x = expr11.x;
// mad r0.y, v1.x, r0.x, c30.x
temp0.y = i.color.x * temp0.x + MinWidth.x;
// mov r1.x, c12.x
temp1.x = expr12.x;
// mad r0.x, v1.y, r1.x, c31.x
temp0.x = i.color.y * temp1.x + MinHeight.x;
// mul r0.xy, r0, v2.yxzw
temp0.xy = temp0.xy * i.texcoord.yx;
// mov r1.x, c13.x
temp1.x = expr13.x;
// mad r0.z, v1.z, r1.x, c32.x
temp0.z = i.color.z * temp1.x + MinSpeed.x;
// mad r1, v0.xyzx, c0.xxxy, c0.yyyx
temp1 = i.position.xyzx * float4(1, 1, 1, 0) + float4(0, 0, 0, 1);
// dp4 r0.w, r1, c22
temp0.w = dot(temp1, (World._m02_m12_m22_m32));
// mad r0.z, r0.z, -c28.x, r0.w
temp0.z = temp0.z * -Time.x + temp0.w;
// mul r0.z, r0.z, c15.x
temp0.z = temp0.z * expr15.x;
// abs r0.w, r0.z
temp0.w = abs(temp0.z);
// sge r0.z, r0.z, -r0.z
temp0.z = (temp0.z >= -temp0.z) ? 1 : 0;
// frc r0.w, r0.w
temp0.w = frac(temp0.w);
// lrp r2.x, r0.z, r0.w, -r0.w
temp2.x = lerp(-temp0.w, temp0.w, temp0.z);
// mad r0.z, r2.x, c29.x, c29.x
temp0.z = temp2.x * RainBoxHeight.x + RainBoxHeight.x;
// mad r2.z, r0.x, c0.z, r0.z
temp2.z = temp0.x * float1(-0.5) + temp0.z;
// mov r2.w, c0.x
temp2.w = float1(1);
// dp4 r2.x, r1, c20
temp2.x = dot(temp1, (World._m00_m10_m20_m30));
// dp4 r2.y, r1, c21
temp2.y = dot(temp1, (World._m01_m11_m21_m31));
// dp4 r0.x, r2, c23
temp0.x = dot(temp2, (View._m00_m10_m20_m30));
// mad r0.x, r0.y, c0.z, r0.x
temp0.x = temp0.y * float1(-0.5) + temp0.x;
// dp4 r0.y, r2, c24
temp0.y = dot(temp2, (View._m01_m11_m21_m31));
// dp4 r0.z, r2, c25
temp0.z = dot(temp2, (View._m02_m12_m22_m32));
// mov r0.w, c0.x
temp0.w = float1(1);
// dp4 oPos.x, r0, c16
o.position.x = dot(temp0, (Projection._m00_m10_m20_m30));
// dp4 oPos.y, r0, c17
o.position.y = dot(temp0, (Projection._m01_m11_m21_m31));
// dp4 oPos.z, r0, c18
o.position.z = dot(temp0, (Projection._m02_m12_m22_m32));
// dp4 oPos.w, r0, c19
o.position.w = dot(temp0, (Projection._m03_m13_m23_m33));
// dp4 r1.x, r0, c26
temp1.x = dot(temp0, (ViewInverse._m00_m10_m20_m30));
// dp4 r1.y, r0, c27
temp1.y = dot(temp0, (ViewInverse._m01_m11_m21_m31));
// add r0.xy, r1, c34.zwzw
temp0.xy = temp1.xy + Shroud.ScaleUV_OffsetUV.zw;
// mul oT1.xy, r0, c34
o.texcoord1 = temp0 * Shroud.ScaleUV_OffsetUV;
// mov oD0.xyz, c0.x
o.color.xyz = float3(1, 1, 1);
// mov oT0.xy, v2
o.texcoord = i.texcoord;
//
return o;
}
technique Default
{
pass pass0
{
VertexShader = compile vs_2_0 Default_VertexShader4(); // 28
PixelShader = compile ps_2_0 Default_PixelShader3(); // 29
ZEnable = 0;
ZWriteEnable = 0;
ZFunc = 4;
AlphaBlendEnable = 1;
CullMode = 1;
SrcBlend = 5;
DestBlend = 6;
}
}
technique Default_M
{
pass pass0
{
VertexShader = compile vs_2_0 Default_M_VertexShader2(); // 30
PixelShader = compile ps_2_0 Default_M_PixelShader1(); // 31
ZEnable = 0;
ZWriteEnable = 0;
ZFunc = 4;
AlphaBlendEnable = 1;
CullMode = 1;
SrcBlend = 5;
DestBlend = 6;
}
}