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

326 lines
9.5 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, c15);
column_major float4x4 WorldViewProjection : WorldViewProjection : register(vs_2_0, c11);
texture Texture1 <string UIWidget = "None";>; // 2
sampler2D Texture1Sampler : register(ps_2_0, s0) <string Texture = "Texture1"; string UIWidget = "None";> =
sampler_state
{
Texture = <Texture1>; // 4
MinFilter = 2;
MagFilter = 2;
MipFilter = 2;
AddressU = 3;
AddressV = 1;
};
texture Texture2 <string UIWidget = "None";>; // 7
sampler2D Texture2Sampler : register(ps_2_0, s1) <string Texture = "Texture2"; string UIWidget = "None";> =
sampler_state
{
Texture = <Texture2>; // 9
MinFilter = 2;
MagFilter = 2;
MipFilter = 2;
AddressU = 3;
AddressV = 1;
};
float3 ColorEmissive : register(ps_2_0, c11) <string UIName = "Emissive Material Color"; string UIWidget = "Color";> = { 1, 1, 1 };
struct
{
float4 ScaleUV_OffsetUV;
} Shroud : register(vs_2_0, c17) <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";>; // 16
sampler2D ShroudTextureSampler : register(ps_2_0, s2) <string Texture = "ShroudTexture"; string UIWidget = "None"; string SasBindAddress = "Terrain.Shroud.Texture"; string ResourceName = "ShaderPreviewShroud.dds";> =
sampler_state
{
Texture = <ShroudTexture>; // 20
MinFilter = 2;
MagFilter = 2;
MipFilter = 2;
AddressU = 3;
AddressV = 3;
};
// Default_M_PixelShader1 Pixel_2_0 Has PRES False
struct Default_M_PixelShader1_Input
{
float2 texcoord : TEXCOORD;
float2 texcoord1 : TEXCOORD1;
float2 texcoord2 : TEXCOORD2;
float color : COLOR;
};
float4 Default_M_PixelShader1(Default_M_PixelShader1_Input i) : COLOR
{
float4 out_color;
float4 temp0, temp1, temp2;
float4 temp3;
// def c0, -0.75, 0, 0, 0
// dcl t0.xy
// dcl t1.xy
// dcl t2.xy
// dcl v0.x
// dcl_2d s0
// dcl_2d s1
// dcl_2d s2
// texld r0, t2, s2
temp0 = tex2D(ShroudTextureSampler, i.texcoord2.xy);
// texld r1, t0, s0
temp1 = tex2D(Texture1Sampler, i.texcoord.xy);
// texld r2, t1, s1
temp2 = tex2D(Texture2Sampler, i.texcoord1.xy);
// add r0.x, r0.x, c0.x
temp0.x = temp0.x + float1(-0.75);
// add r0.x, r0.x, r0.x
temp0.x = temp0.x + temp0.x;
// max r3.w, r0.x, c0.y
temp3.w = max(temp0.x, float1(0));
// add r0.x, r3.w, r3.w
temp0.x = temp3.w + temp3.w;
// mul r1, r1, r2
temp1 = temp1 * temp2;
// mul r0.yzw, r1.wzyx, c11.wzyx
temp0.yzw = temp1.zyx * ColorEmissive.zyx;
// mul r1.w, r1.w, v0.x
temp1.w = temp1.w * i.color.x;
// mul r1.xyz, r0.x, r0.wzyx
temp1.xyz = temp0.xxx * temp0.wzy;
// mov oC0, r1
out_color = temp1;
//
return out_color;
}
// Default_M_VertexShader2 Vertex_2_0 Has PRES False
struct Default_M_VertexShader2_Input
{
float4 position : POSITION;
float4 texcoord : TEXCOORD;
float4 texcoord1 : TEXCOORD1;
float4 color : COLOR;
};
struct Default_M_VertexShader2_Output
{
float4 position : POSITION;
float2 texcoord2 : TEXCOORD2;
float2 texcoord : TEXCOORD;
float2 texcoord1 : TEXCOORD1;
float color : COLOR;
};
Default_M_VertexShader2_Output Default_M_VertexShader2(Default_M_VertexShader2_Input i)
{
Default_M_VertexShader2_Output o;
float4 temp0;
float2 temp1;
// def c0, 1, 0, 0, 0
// dcl_position v0
// dcl_texcoord v1
// dcl_texcoord1 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 oPos.x, r0, c11
o.position.x = dot(temp0, (WorldViewProjection._m00_m10_m20_m30));
// dp4 oPos.y, r0, c12
o.position.y = dot(temp0, (WorldViewProjection._m01_m11_m21_m31));
// dp4 oPos.z, r0, c13
o.position.z = dot(temp0, (WorldViewProjection._m02_m12_m22_m32));
// dp4 oPos.w, r0, c14
o.position.w = dot(temp0, (WorldViewProjection._m03_m13_m23_m33));
// dp4 r1.x, r0, c15
temp1.x = dot(temp0, (World._m00_m10_m20_m30));
// dp4 r1.y, r0, c16
temp1.y = dot(temp0, (World._m01_m11_m21_m31));
// add r0.xy, r1, c17.zwzw
temp0.xy = temp1.xy + Shroud.ScaleUV_OffsetUV.zw;
// mul oT2.xy, r0, c17
o.texcoord2 = temp0 * Shroud.ScaleUV_OffsetUV;
// mov oT0.xy, v1
o.texcoord = i.texcoord;
// mov oT1.xy, v2
o.texcoord1 = i.texcoord1;
// mov oD0.x, v3.x
o.color = i.color.x;
//
return o;
}
// Default_PixelShader3 Pixel_2_0 Has PRES False
struct Default_PixelShader3_Input
{
float2 texcoord : TEXCOORD;
float2 texcoord1 : TEXCOORD1;
float2 texcoord2 : TEXCOORD2;
float color : COLOR;
};
float4 Default_PixelShader3(Default_PixelShader3_Input i) : COLOR
{
float4 out_color;
float4 temp0, temp1, temp2;
float4 temp3;
// def c0, 2.2, -0.75, 0, 0
// dcl t0.xy
// dcl t1.xy
// dcl t2.xy
// dcl v0.x
// dcl_2d s0
// dcl_2d s1
// dcl_2d s2
// texld r0, t2, s2
temp0 = tex2D(ShroudTextureSampler, i.texcoord2.xy);
// texld r1, t0, s0
temp1 = tex2D(Texture1Sampler, i.texcoord.xy);
// texld r2, t1, s1
temp2 = tex2D(Texture2Sampler, i.texcoord1.xy);
// add r0.x, r0.x, c0.y
temp0.x = temp0.x + float1(-0.75);
// add r0.x, r0.x, r0.x
temp0.x = temp0.x + temp0.x;
// max r3.w, r0.x, c0.z
temp3.w = max(temp0.x, float1(0));
// add r0.x, r3.w, r3.w
temp0.x = temp3.w + temp3.w;
// mul r1, r1, r2
temp1 = temp1 * temp2;
// mul r0.yzw, r1.wzyx, c11.wzyx
temp0.yzw = temp1.zyx * ColorEmissive.zyx;
// mul r1.w, r1.w, v0.x
temp1.w = temp1.w * i.color.x;
// log r2.x, r0.w
temp2.x = log2(temp0.w);
// log r2.y, r0.z
temp2.y = log2(temp0.z);
// log r2.z, r0.y
temp2.z = log2(temp0.y);
// mul r0.yzw, r2.wzyx, c0.x
temp0.yzw = temp2.zyx * float3(2.2, 2.2, 2.2);
// exp r2.x, r0.w
temp2.x = exp2(temp0.w);
// exp r2.y, r0.z
temp2.y = exp2(temp0.z);
// exp r2.z, r0.y
temp2.z = exp2(temp0.y);
// mul r1.xyz, r0.x, r2
temp1.xyz = temp0.xxx * temp2.xyz;
// mov oC0, r1
out_color = temp1;
//
return out_color;
}
// Default_VertexShader4 Vertex_2_0 Has PRES False
struct Default_VertexShader4_Input
{
float4 position : POSITION;
float4 texcoord : TEXCOORD;
float4 texcoord1 : TEXCOORD1;
float4 color : COLOR;
};
struct Default_VertexShader4_Output
{
float4 position : POSITION;
float2 texcoord2 : TEXCOORD2;
float2 texcoord : TEXCOORD;
float2 texcoord1 : TEXCOORD1;
float color : COLOR;
};
Default_VertexShader4_Output Default_VertexShader4(Default_VertexShader4_Input i)
{
Default_VertexShader4_Output o;
float4 temp0;
float2 temp1;
// def c0, 1, 0, 0, 0
// dcl_position v0
// dcl_texcoord v1
// dcl_texcoord1 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 oPos.x, r0, c11
o.position.x = dot(temp0, (WorldViewProjection._m00_m10_m20_m30));
// dp4 oPos.y, r0, c12
o.position.y = dot(temp0, (WorldViewProjection._m01_m11_m21_m31));
// dp4 oPos.z, r0, c13
o.position.z = dot(temp0, (WorldViewProjection._m02_m12_m22_m32));
// dp4 oPos.w, r0, c14
o.position.w = dot(temp0, (WorldViewProjection._m03_m13_m23_m33));
// dp4 r1.x, r0, c15
temp1.x = dot(temp0, (World._m00_m10_m20_m30));
// dp4 r1.y, r0, c16
temp1.y = dot(temp0, (World._m01_m11_m21_m31));
// add r0.xy, r1, c17.zwzw
temp0.xy = temp1.xy + Shroud.ScaleUV_OffsetUV.zw;
// mul oT2.xy, r0, c17
o.texcoord2 = temp0 * Shroud.ScaleUV_OffsetUV;
// mov oT0.xy, v1
o.texcoord = i.texcoord;
// mov oT1.xy, v2
o.texcoord1 = i.texcoord1;
// mov oD0.x, v3.x
o.color = i.color.x;
//
return o;
}
technique Default
{
pass pass0
{
VertexShader = compile vs_2_0 Default_VertexShader4(); // 25
PixelShader = compile ps_2_0 Default_PixelShader3(); // 26
ZEnable = 1;
ZWriteEnable = 0;
ZFunc = 4;
AlphaBlendEnable = 1;
CullMode = 1;
SrcBlend = 5;
DestBlend = 2;
}
}
technique Default_M
{
pass pass0
{
VertexShader = compile vs_2_0 Default_M_VertexShader2(); // 27
PixelShader = compile ps_2_0 Default_M_PixelShader1(); // 28
ZEnable = 1;
ZWriteEnable = 0;
ZFunc = 4;
AlphaBlendEnable = 1;
CullMode = 1;
SrcBlend = 5;
DestBlend = 2;
}
}