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

458 lines
16 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 };
bool HasRecolorColors <string UIWidget = "None"; string SasBindAddress = "WW3D.HasRecolorColors"; bool ExportValue = 0;>;
float3 RecolorColor : register(ps_2_0, c0) <bool unmanaged = 1;>;
row_major float4x4 ShadowMapWorldToShadow <bool unmanaged = 1;>;
float OpacityOverride : register(vs_2_0, c1) <bool unmanaged = 1;> = { 1 };
float3 TintColor <bool unmanaged = 1;> = { 1, 1, 1 };
float3 EyePosition : register(vs_2_0, c123) <bool unmanaged = 1;>;
column_major float4x4 ViewProjection : register(vs_2_0, c119) <bool unmanaged = 1;>;
float4 WorldBones[128] <bool unmanaged = 1;>;
int NumJointsPerVertex <string UIWidget = "None"; string SasBindAddress = "Sas.Skeleton.NumJointsPerVertex";>;
column_major float4x3 World : World : register(vs_2_0, c124);
float Time : Time;
texture Texture_0 <string UIName = "Diffuse Texture";>; // 6
sampler2D Texture_0Sampler : register(ps_2_0, s0) <string Texture = "Texture_0"; string UIName = "Diffuse Texture";> =
sampler_state
{
Texture = <Texture_0>; // 8
MinFilter = 3;
MagFilter = 2;
MipFilter = 2;
AddressU = 1;
AddressV = 1;
};
float3 ColorDiffuse : register(vs_2_0, c22) <string UIName = "Diffuse Material Color"; string UIWidget = "Color";> = { 1, 1, 1 };
float EmissiveHDRMultipler : register(ps_2_0, c11) <string UIName = "Emissive HDR Multiplier"; string UIWidget = "Slider"; float UIMax = 200;> = { 1 };
bool MultiTextureEnable : register(ps_2_0, c12) <string UIName = "Multi-Texture Enable";>;
float4 DiffuseCoordOffset : register(vs_2_0, c23) <string UIName = "Diffuse Coord Offset/Scale"; string UIWidget = "Slider"; float UIMax = 1; float UIMin = 0; float UIStep = 0.001;> = { 0, 0, 1, 1 };
bool MultiplyBlendEnable : register(ps_2_0, c13) <string UIName = "Multiply Blend Enable";>;
float EdgeFadeOut <string UIName = "Edge fade out"; string UIWidget = "Slider";>;
texture Texture_1 <string UIName = "Displace Texture";>; // 21
sampler2D Texture_1Sampler : register(ps_2_0, s1) <string Texture = "Texture_1"; string UIName = "Displace Texture";> =
sampler_state
{
Texture = <Texture_1>; // 23
MinFilter = 3;
MagFilter = 2;
MipFilter = 2;
AddressU = 1;
AddressV = 1;
};
bool UniqueWorldCoordEnable <string UIName = "Unique World Coords Enable";>;
float UniqueWorldCoordScalar : register(vs_2_0, c24) <string UIName = "Unique World Coords Scale"; string UIWidget = "Slider"; float UIMax = 1; float UIMin = 0; float UIStep = 0.001;> = { 0.01 };
float UniqueWorldCoordStrength <string UIName = "Unique World Coords Strength"; string UIWidget = "Slider"; float UIMax = 1; float UIMin = 0; float UIStep = 0.01;> = { 1 };
float DisplaceScalar : register(vs_2_0, c25) <string UIName = "Displace Scale"; string UIWidget = "Slider"; float UIMax = 50; float UIMin = 0; float UIStep = 0.01;> = { 1 };
float DisplaceAmp : register(ps_2_0, c14) <string UIName = "Displace Amplitude"; string UIWidget = "Slider"; float UIMax = 50; float UIMin = 0; float UIStep = 0.01;> = { 1 };
float DisplaceDivergenceAngle <string UIName = "Displace Divergence Angle"; string UIWidget = "Slider"; float UIMax = 180; float UIMin = 0; float UIStep = 0.5;>;
float DisplaceSpeed <string UIName = "Displace Speed"; string UIWidget = "Slider"; float UIMax = 50; float UIMin = 0; float UIStep = 0.01;> = { 1 };
bool UseRecolorColors : register(ps_2_0, c15) <string UIName = "Allow House Color";>;
bool CullingEnable <string UIName = "Culling Enable";> = { 1 };
// Default_Expression1 Expression_2_0 Has PRES False
float Default_Expression1()
{
float4 temp0;
float4 temp1;
float4 temp2;
float1 expr0;
// add r0.x, c0.x, (-1)
temp0.x = MultiplyBlendEnable.x + (-1);
// mul r1.x, r0.x, r0.x
temp1.x = temp0.x * temp0.x;
// neg r0.x, r1.x
temp0.x = -temp1.x;
// ge r2.x, r0.x, r1.x
temp2.x = temp0.x >= temp1.x;
// neg r0.x, r2.x
temp0.x = -temp2.x;
// add c0.x, r0.x, (2)
expr0.x = temp0.x + (2);
return expr0;
}
// Default_Expression2 Expression_2_0 Has PRES False
float Default_Expression2()
{
float4 temp0;
float4 temp1;
float4 temp2;
float1 expr0;
// add r0.x, c0.x, (-1)
temp0.x = MultiplyBlendEnable.x + (-1);
// mul r1.x, r0.x, r0.x
temp1.x = temp0.x * temp0.x;
// neg r0.x, r1.x
temp0.x = -temp1.x;
// ge r2.x, r0.x, r1.x
temp2.x = temp0.x >= temp1.x;
// mul r0.x, r2.x, (7)
temp0.x = temp2.x * (7);
// add c0.x, r0.x, (2)
expr0.x = temp0.x + (2);
return expr0;
}
// Default_Expression3 Expression_2_0 Has PRES False
float Default_Expression3()
{
float1 expr0;
// add c0.x, c0.x, (1)
expr0.x = CullingEnable.x + (1);
return expr0;
}
// Default_PixelShader4 Pixel_2_0 Has PRES False
struct Default_PixelShader4_Input
{
float4 texcoord : TEXCOORD;
float4 texcoord1 : TEXCOORD1;
float4 texcoord2 : TEXCOORD2;
float texcoord4 : TEXCOORD4;
};
float4 Default_PixelShader4(Default_PixelShader4_Input i) : COLOR
{
float4 out_color;
float4 temp0, temp1, temp2;
// def c1, -1, 2.2, 0.5, 1
// def c2, 0.35, 0, 0, 0
// dcl t0
// dcl t1
// dcl t2
// dcl t4.x
// dcl_2d s0
// dcl_2d s1
// mov r0.x, t2.z
temp0.x = i.texcoord2.z;
// mov r0.y, t2.w
temp0.y = i.texcoord2.w;
// texld r0, r0, s1
temp0 = tex2D(Texture_1Sampler, temp0.xy);
// texld r1, t2, s1
temp1 = tex2D(Texture_1Sampler, i.texcoord2.xy);
// add r2.yw, r0.y, r1.y
temp2.yw = temp0.y + temp1.y;
// add r2.xz, r0.x, r1.x
temp2.xz = temp0.x + temp1.x;
// add r0, r2, c1.x
temp0 = temp2 + float4(-1, -1, -1, -1);
// mad r0, r0, c14.x, t1
temp0 = temp0 * DisplaceAmp.x + i.texcoord1;
// mov r1.x, r0.z
temp1.x = temp0.z;
// mov r1.y, r0.w
temp1.y = temp0.w;
// texld r0, r0, s0
temp0 = tex2D(Texture_0Sampler, temp0.xy);
// texld r1, r1, s0
temp1 = tex2D(Texture_0Sampler, temp1.xy);
// mul r1, r0, r1
temp1 = temp0 * temp1;
// cmp r0, -c12.x, r0, r1
temp0 = (-MultiTextureEnable.x >= 0) ? temp0 : temp1;
// log r1.x, r0.x
temp1.x = log2(temp0.x);
// log r1.y, r0.y
temp1.y = log2(temp0.y);
// log r1.z, r0.z
temp1.z = log2(temp0.z);
// mul r1.xyz, r1, c1.y
temp1.xyz = temp1.xyz * float3(2.2, 2.2, 2.2);
// exp r0.x, r1.x
temp0.x = exp2(temp1.x);
// exp r0.y, r1.y
temp0.y = exp2(temp1.y);
// exp r0.z, r1.z
temp0.z = exp2(temp1.z);
// mul r1.xyz, t0, c11.x
temp1.xyz = i.texcoord.xyz * EmissiveHDRMultipler.xxx;
// mul r1.w, t0.w, t0.w
temp1.w = i.texcoord.w * i.texcoord.w;
// mov r2.xyz, t0.w
temp2.xyz = i.texcoord.w;
// mov r2.w, c11.x
temp2.w = EmissiveHDRMultipler.x;
// mul r1, r1, r2
temp1 = temp1 * temp2;
// mul r2, r0, r1
temp2 = temp0 * temp1;
// mad r0, r1, -r0, c1.z
temp0 = temp1 * -temp0 + float4(0.5, 0.5, 0.5, 0.5);
// cmp r0, -c13.x, r2, r0
temp0 = (-MultiplyBlendEnable.x >= 0) ? temp2 : temp0;
// mov r1.w, c1.w
temp1.w = float1(1);
// add r1.xyz, r1.w, -c0
temp1.xyz = temp1.www + -RecolorColor.xyz;
// mov r2.xyz, c0
temp2.xyz = RecolorColor.xyz;
// mad r1.xyz, r1, c2.x, r2
temp1.xyz = temp1.xyz * float3(0.35, 0.35, 0.35) + temp2.xyz;
// mul r1.xyz, r0, r1
temp1.xyz = temp0.xyz * temp1.xyz;
// cmp r1.xyz, -c15.x, r0, r1
temp1.xyz = (-UseRecolorColors.xxx >= 0) ? temp0.xyz : temp1.xyz;
// add r1.xyz, r1, r1
temp1.xyz = temp1.xyz + temp1.xyz;
// mul r0.xyz, r1, t4.x
temp0.xyz = temp1.xyz * i.texcoord4.xxx;
// mov oC0, r0
out_color = temp0;
//
return out_color;
}
// Default_VertexShader5 Vertex_2_0 Has PRES True
struct Default_VertexShader5_Input
{
float4 position : POSITION;
float4 normal : NORMAL;
float4 texcoord : TEXCOORD;
float4 color : COLOR;
};
struct Default_VertexShader5_Output
{
float4 texcoord2 : TEXCOORD2;
float4 position : POSITION;
float4 texcoord : TEXCOORD;
float4 texcoord1 : TEXCOORD1;
float texcoord4 : TEXCOORD4;
};
Default_VertexShader5_Output Default_VertexShader5(Default_VertexShader5_Input i)
{
/*
PRSI
OutputRegisterOffset: 11
Unknown1: 0
Unknown2: 0
OutputRegisterCount: 11
Unknown3: 0
Unknown4: 0
Unknown5: 11
Unknown6: 5
Mappings: 3
0 - ConstOutput: 17 ConstInput 3
1 - ConstOutput: 21 ConstInput 1
2 - ConstOutput: 0 ConstInput 0
*/
float4 expr11;
float4 expr12;
float4 expr13;
float4 expr14;
float4 expr15;
float4 expr16;
float4 expr17;
float4 expr18;
float4 expr19;
float4 expr20;
float4 expr21;
{
float4 temp0;
float4 temp1;
// Expression_2_1
// mul r0.x, c0.x, c8.x
temp0.x = Time.x * DisplaceSpeed.x;
// mul c14.x, r0.x, (0.01)
expr14.x = temp0.x * (0.01);
// add r0.x, c6.x, (-1)
temp0.x = UniqueWorldCoordEnable.x + (-1);
// mul r1.x, r0.x, r0.x
temp1.x = temp0.x * temp0.x;
// neg r0.x, r1.x
temp0.x = -temp1.x;
// ge c11.x, r0.x, r1.x
expr11.x = temp0.x >= temp1.x;
// rcp c15.x, c5.x
expr15.x = 1.0f / (EdgeFadeOut.x);
// add r0.x, c4.x, (-1)
temp0.x = MultiplyBlendEnable.x + (-1);
// mul r1.x, r0.x, r0.x
temp1.x = temp0.x * temp0.x;
// neg r0.x, r1.x
temp0.x = -temp1.x;
// ge c18.x, r0.x, r1.x
expr18.x = temp0.x >= temp1.x;
// neg r0.xyz, c1.xyz
temp0.xyz = -ColorDiffuse.xyz;
// add c17.xyz, (1, 1, 1), r0.xyz
expr17.xyz = float3(1, 1, 1) + temp0.xyz;
// mul r0.xy, c0.x, c3.xy
temp0.xy = Time.x * DiffuseCoordOffset.xy;
// frc c19.xy, r0.xy
expr19.xy = frac(temp0.xy);
// add r0.x, c2.x, (-1)
temp0.x = MultiTextureEnable.x + (-1);
// mul r1.x, r0.x, r0.x
temp1.x = temp0.x * temp0.x;
// neg r0.x, r1.x
temp0.x = -temp1.x;
// ge c21.x, r0.x, r1.x
expr21.x = temp0.x >= temp1.x;
// mul r0.x, c7.x, (0.0027777312217828493)
temp0.x = DisplaceDivergenceAngle.x * (0.0027777312217828493);
// add r1.x, r0.x, (0.5)
temp1.x = temp0.x + (0.5);
// frc r0.x, r1.x
temp0.x = frac(temp1.x);
// mul r1.x, r0.x, (6.283185307179586)
temp1.x = temp0.x * (6.283185307179586);
// add r0.x, r1.x, (-3.141592653589793)
temp0.x = temp1.x + (-3.141592653589793);
// cos r1.x, r0.x
temp1.x = cos(temp0.x);
// sin r1.y, r0.x
temp1.y = sin(temp0.x);
// mov c12.x, r1.y
expr12.x = temp1.y;
// mov c13.x, r1.x
expr13.x = temp1.x;
}
Default_VertexShader5_Output o;
float4 temp0, temp1, temp2;
// def c0, 1, 0, 0.1, 0
// def c2, -2, 3, 0, 0
// dcl_position v0
// dcl_normal v1
// dcl_texcoord v2
// dcl_color v3
// mad r0, v0.xyzx, c0.xxxy, c0.yyyx
temp0 = i.position.xyzx * float4(1, 1, 1, 0) + float4(0, 0, 0, 1);
// dp4 r1.x, r0, c124
temp1.x = dot(temp0, (World._m00_m10_m20_m30));
// dp4 r1.y, r0, c125
temp1.y = dot(temp0, (World._m01_m11_m21_m31));
// dp4 r1.z, r0, c126
temp1.z = dot(temp0, (World._m02_m12_m22_m32));
// add r0.x, r1.x, r1.y
temp0.x = temp1.x + temp1.y;
// mul r0.x, r0.x, c24.x
temp0.x = temp0.x * UniqueWorldCoordScalar.x;
// mul r0.x, r0.x, c11.x
temp0.x = temp0.x * expr11.x;
// mul r0.yz, v2.xxyw, c25.x
temp0.yz = i.texcoord.xy * DisplaceScalar.xx;
// mad r0.x, r0.x, c0.z, r0.z
temp0.x = temp0.x * float1(0.1) + temp0.z;
// mul r0.z, r0.x, c13.x
temp0.z = temp0.x * expr13.x;
// mad oT2.y, r0.y, -c12.x, r0.z
o.texcoord2.y = temp0.y * -expr12.x + temp0.z;
// mad oT2.w, r0.y, c12.x, r0.z
o.texcoord2.w = temp0.y * expr12.x + temp0.z;
// mul r0.y, r0.y, c13.x
temp0.y = temp0.y * expr13.x;
// mad r0.z, r0.x, c12.x, r0.y
temp0.z = temp0.x * expr12.x + temp0.y;
// mad r0.x, r0.x, -c12.x, r0.y
temp0.x = temp0.x * -expr12.x + temp0.y;
// add oT2.xz, r0.zyxw, c14.x
o.texcoord2.xz = temp0.zx + expr14.xx;
// mov r1.w, c0.x
temp1.w = float1(1);
// dp4 oPos.x, r1, c119
o.position.x = dot(temp1, (ViewProjection._m00_m10_m20_m30));
// dp4 oPos.y, r1, c120
o.position.y = dot(temp1, (ViewProjection._m01_m11_m21_m31));
// dp4 oPos.z, r1, c121
o.position.z = dot(temp1, (ViewProjection._m02_m12_m22_m32));
// dp4 oPos.w, r1, c122
o.position.w = dot(temp1, (ViewProjection._m03_m13_m23_m33));
// add r0.xyz, -r1, c123
temp0.xyz = -temp1.xyz + EyePosition.xyz;
// nrm r1.xyz, r0
temp1.xyz = normalize(temp0.xyz).xyz;
// dp3 r0.x, v1, c124
temp0.x = dot(i.normal.xyz, (World._m00_m10_m20_m30).xyz);
// dp3 r0.y, v1, c125
temp0.y = dot(i.normal.xyz, (World._m01_m11_m21_m31).xyz);
// dp3 r0.z, v1, c126
temp0.z = dot(i.normal.xyz, (World._m02_m12_m22_m32).xyz);
// dp3 r0.x, r1, r0
temp0.x = dot(temp1.xyz, temp0.xyz);
// abs r0.x, r0.x
temp0.x = abs(temp0.x);
// mul r0.x, r0.x, c15.x
temp0.x = temp0.x * expr15.x;
// max r0.x, r0.x, c0.y
temp0.x = max(temp0.x, float1(0));
// min r0.x, r0.x, c0.x
temp0.x = min(temp0.x, float1(1));
// mad r0.y, r0.x, c2.x, c2.y
temp0.y = temp0.x * float1(-2) + float1(3);
// mul r0.x, r0.x, r0.x
temp0.x = temp0.x * temp0.x;
// mul r0.x, r0.y, r0.x
temp0.x = temp0.y * temp0.x;
// mul r0.w, r0.x, v3.w
temp0.w = temp0.x * i.color.w;
// mov r1.xy, c0
temp1.xy = float2(1, 0);
// mad r2, c22.xyzx, r1.xxxy, r1.yyyx
temp2 = ColorDiffuse.xyzx * temp1.xxxy + temp1.yyyx;
// mul r0.xyz, v3, c1.x
temp0.xyz = i.color.xyz * OpacityOverride.xxx;
// mul r2, r0, r2
temp2 = temp0 * temp2;
// mad r1, c17.xyzx, r1.xxxy, r1.yyyx
temp1 = expr17.xyzx * temp1.xxxy + temp1.yyyx;
// mad r0, r0, r1, -r2
temp0 = temp0 * temp1 + -temp2;
// mad oT0, c18.x, r0, r2
o.texcoord = expr18.x * temp0 + temp2;
// mul r0.xy, v2, c23.zwzw
temp0.xy = i.texcoord.xy * DiffuseCoordOffset.zw;
// mov r0.zw, c23
temp0.zw = DiffuseCoordOffset.zw;
// mad r0.xy, r0, r0.zwzw, -c19
temp0.xy = temp0.xy * temp0.zw + -expr19.xy;
// mad r0.zw, v2.xyxy, r0, c19.xyxy
temp0.zw = i.texcoord.xy * temp0.zw + expr19.xy;
// add r0.xy, r0, -r0.zwzw
temp0.xy = temp0.xy + -temp0.zw;
// mad oT1.zw, c21.x, r0.xyxy, r0
o.texcoord1.zw = expr21.xx * temp0.xy + temp0.zw;
// mov oT1.xy, r0.zwzw
o.texcoord1.xy = temp0.zw;
// mov oT4.x, c0.x
o.texcoord4 = float4(1, 1, 1, 1);
//
return o;
}
technique Default
{
pass P0
{
VertexShader = compile vs_2_0 Default_VertexShader5(); // 41
PixelShader = compile ps_2_0 Default_PixelShader4(); // 42
ZEnable = 1;
ZFunc = 4;
ZWriteEnable = 0;
AlphaBlendEnable = 1;
CullMode = Default_Expression3(); // 0
SrcBlend = Default_Expression2(); // 0
DestBlend = Default_Expression1(); // 0
}
}