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

355 lines
9.7 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;>;
bool IsHdrEnabled <string SasBindAddress = "WW3D.IsHdrEnabled";>;
texture FrameBufferSampler <string SasBindAddress = "PostEffect.FrameBufferTexture";>; // 3
sampler2D FrameBufferSamplerSampler : register(ps_2_0, s0) <string Texture = "FrameBufferSampler"; string SasBindAddress = "PostEffect.FrameBufferTexture";> =
sampler_state
{
Texture = <FrameBufferSampler>; // 5
MinFilter = 2;
MagFilter = 2;
MipFilter = 1;
AddressU = 3;
AddressV = 3;
};
texture LookupTexture <string SasBindAddress = "PostEffect.LookupTable.LookupTexture";>; // 8
sampler3D LookupTextureSampler : register(ps_2_0, s1) <string Texture = "LookupTexture"; string SasBindAddress = "PostEffect.LookupTable.LookupTexture";> =
sampler_state
{
Texture = <LookupTexture>; // 10
MinFilter = 2;
MagFilter = 2;
MipFilter = 1;
AddressU = 3;
AddressV = 3;
AddressW = 3;
};
texture FilmTonemappingLookupTexture <string SasBindAddress = "PostEffect.LookupTable.FilmTonemapping";>; // 13
sampler2D FilmTonemappingLookupTextureSampler <string Texture = "FilmTonemappingLookupTexture"; string SasBindAddress = "PostEffect.LookupTable.FilmTonemapping";> =
sampler_state
{
Texture = <FilmTonemappingLookupTexture>; // 15
MinFilter = 2;
MagFilter = 2;
MipFilter = 1;
AddressU = 3;
AddressV = 3;
};
float4 BlendFactor : register(ps_2_0, c11) <string SasBindAddress = "PostEffect.LookupTable.BlendFactor";> = { 1, 1, 1, 1 };
float3 ExposureLevel : register(ps_2_0, c12) <string SasBindAddress = "PostEffect.LookupTable.ExposureLevel";> = { 1, 1, 1 };
// ResolveOnly_M_PixelShader1 Pixel_2_0 Has PRES False
float4 ResolveOnly_M_PixelShader1(float2 texcoord : TEXCOORD) : COLOR
{
float4 out_color;
float4 temp0;
// dcl t0.xy
// dcl_2d s0
// texld r0, t0, s0
temp0 = tex2D(FrameBufferSamplerSampler, texcoord.xy);
// mul r0.xyz, r0, c11
temp0.xyz = temp0.xyz * ExposureLevel.xyz;
// mov oC0, r0
out_color = temp0;
//
return out_color;
}
// ResolveOnly_M_VertexShader2 Vertex_2_0 Has PRES False
struct ResolveOnly_M_VertexShader2_Input
{
float4 position : POSITION;
float4 texcoord : TEXCOORD;
};
struct ResolveOnly_M_VertexShader2_Output
{
float4 position : POSITION;
float2 texcoord : TEXCOORD;
};
ResolveOnly_M_VertexShader2_Output ResolveOnly_M_VertexShader2(ResolveOnly_M_VertexShader2_Input i)
{
ResolveOnly_M_VertexShader2_Output o;
// def c0, 1, 0, 0, 0
// dcl_position v0
// dcl_texcoord v1
// mov oPos.xyz, v0
o.position.xyz = i.position.xyz;
// mov oPos.w, c0.x
o.position.w = float1(1);
// mov oT0.xy, v1
o.texcoord = i.texcoord;
//
return o;
}
// ResolveOnly_PixelShader3 Pixel_2_0 Has PRES False
float4 ResolveOnly_PixelShader3(float2 texcoord : TEXCOORD) : COLOR
{
float4 out_color;
float4 temp0;
float3 temp1, temp2, temp3;
// def c0, 6, 0.1666667, 1, 0
// dcl t0.xy
// dcl_2d s0
// texld r0, t0, s0
temp0 = tex2D(FrameBufferSamplerSampler, texcoord.xy);
// mul r1.xyz, r0, c11
temp1.xyz = temp0.xyz * ExposureLevel.xyz;
// mul r2.xyz, r1, c0.x
temp2.xyz = temp1.xyz * float3(6, 6, 6);
// mad r3.xyz, r1, c0.y, c0.z
temp3.xyz = temp1.xyz * float3(0.16666667, 0.16666667, 0.16666667) + float3(1, 1, 1);
// mad r1.xyz, r1, c0.x, c0.z
temp1.xyz = temp1.xyz * float3(6, 6, 6) + float3(1, 1, 1);
// mul r2.xyz, r2, r3
temp2.xyz = temp2.xyz * temp3.xyz;
// rcp r3.x, r1.x
temp3.x = 1.0f / temp1.x;
// rcp r3.y, r1.y
temp3.y = 1.0f / temp1.y;
// rcp r3.z, r1.z
temp3.z = 1.0f / temp1.z;
// mul r0.xyz, r2, r3
temp0.xyz = temp2.xyz * temp3.xyz;
// mov oC0, r0
out_color = temp0;
//
return out_color;
}
// ResolveOnly_VertexShader4 Vertex_2_0 Has PRES False
struct ResolveOnly_VertexShader4_Input
{
float4 position : POSITION;
float4 texcoord : TEXCOORD;
};
struct ResolveOnly_VertexShader4_Output
{
float4 position : POSITION;
float2 texcoord : TEXCOORD;
};
ResolveOnly_VertexShader4_Output ResolveOnly_VertexShader4(ResolveOnly_VertexShader4_Input i)
{
ResolveOnly_VertexShader4_Output o;
// def c0, 1, 0, 0, 0
// dcl_position v0
// dcl_texcoord v1
// mov oPos.xyz, v0
o.position.xyz = i.position.xyz;
// mov oPos.w, c0.x
o.position.w = float1(1);
// mov oT0.xy, v1
o.texcoord = i.texcoord;
//
return o;
}
// Default_M_PixelShader5 Pixel_2_0 Has PRES False
float4 Default_M_PixelShader5(float2 texcoord : TEXCOORD) : COLOR
{
float4 out_color;
float4 temp0, temp1, temp2;
// dcl t0.xy
// dcl_2d s0
// dcl_volume s1
// texld r0, t0, s0
temp0 = tex2D(FrameBufferSamplerSampler, texcoord.xy);
// mul r0.xyz, r0, c12
temp0.xyz = temp0.xyz * ExposureLevel.xyz;
// texld r1, r0, s1
temp1 = tex3D(LookupTextureSampler, temp0.xyz);
// lrp r2, c11.x, r1, r0
temp2 = lerp(temp0, temp1, BlendFactor.x);
// mov oC0, r2
out_color = temp2;
//
return out_color;
}
// Default_M_VertexShader6 Vertex_2_0 Has PRES False
struct Default_M_VertexShader6_Input
{
float4 position : POSITION;
float4 texcoord : TEXCOORD;
};
struct Default_M_VertexShader6_Output
{
float4 position : POSITION;
float2 texcoord : TEXCOORD;
};
Default_M_VertexShader6_Output Default_M_VertexShader6(Default_M_VertexShader6_Input i)
{
Default_M_VertexShader6_Output o;
// def c0, 1, 0, 0, 0
// dcl_position v0
// dcl_texcoord v1
// mov oPos.xyz, v0
o.position.xyz = i.position.xyz;
// mov oPos.w, c0.x
o.position.w = float1(1);
// mov oT0.xy, v1
o.texcoord = i.texcoord;
//
return o;
}
// Default_PixelShader7 Pixel_2_0 Has PRES False
float4 Default_PixelShader7(float2 texcoord : TEXCOORD) : COLOR
{
float4 out_color;
float4 temp0, temp1, temp2;
float3 temp3;
// def c0, 6, 0.1666667, 1, 0
// dcl t0.xy
// dcl_2d s0
// dcl_volume s1
// texld r0, t0, s0
temp0 = tex2D(FrameBufferSamplerSampler, texcoord.xy);
// mul r1.xyz, r0, c12
temp1.xyz = temp0.xyz * ExposureLevel.xyz;
// mul r2.xyz, r1, c0.x
temp2.xyz = temp1.xyz * float3(6, 6, 6);
// mad r3.xyz, r1, c0.y, c0.z
temp3.xyz = temp1.xyz * float3(0.16666667, 0.16666667, 0.16666667) + float3(1, 1, 1);
// mad r1.xyz, r1, c0.x, c0.z
temp1.xyz = temp1.xyz * float3(6, 6, 6) + float3(1, 1, 1);
// mul r2.xyz, r2, r3
temp2.xyz = temp2.xyz * temp3.xyz;
// rcp r3.x, r1.x
temp3.x = 1.0f / temp1.x;
// rcp r3.y, r1.y
temp3.y = 1.0f / temp1.y;
// rcp r3.z, r1.z
temp3.z = 1.0f / temp1.z;
// mul r0.xyz, r2, r3
temp0.xyz = temp2.xyz * temp3.xyz;
// texld r1, r0, s1
temp1 = tex3D(LookupTextureSampler, temp0.xyz);
// lrp r2, c11.x, r1, r0
temp2 = lerp(temp0, temp1, BlendFactor.x);
// mov oC0, r2
out_color = temp2;
//
return out_color;
}
// Default_VertexShader8 Vertex_2_0 Has PRES False
struct Default_VertexShader8_Input
{
float4 position : POSITION;
float4 texcoord : TEXCOORD;
};
struct Default_VertexShader8_Output
{
float4 position : POSITION;
float2 texcoord : TEXCOORD;
};
Default_VertexShader8_Output Default_VertexShader8(Default_VertexShader8_Input i)
{
Default_VertexShader8_Output o;
// def c0, 1, 0, 0, 0
// dcl_position v0
// dcl_texcoord v1
// mov oPos.xyz, v0
o.position.xyz = i.position.xyz;
// mov oPos.w, c0.x
o.position.w = float1(1);
// mov oT0.xy, v1
o.texcoord = i.texcoord;
//
return o;
}
technique Default
{
pass P0
{
VertexShader = compile vs_2_0 Default_VertexShader8(); // 20
PixelShader = compile ps_2_0 Default_PixelShader7(); // 21
ZEnable = 0;
ZWriteEnable = 0;
CullMode = 1;
AlphaBlendEnable = 0;
AlphaTestEnable = 0;
}
}
technique Default_M
{
pass P0
{
VertexShader = compile vs_2_0 Default_M_VertexShader6(); // 22
PixelShader = compile ps_2_0 Default_M_PixelShader5(); // 23
ZEnable = 0;
ZWriteEnable = 0;
CullMode = 1;
AlphaBlendEnable = 0;
AlphaTestEnable = 0;
}
}
technique ResolveOnly
{
pass P0
{
VertexShader = compile vs_2_0 ResolveOnly_VertexShader4(); // 24
PixelShader = compile ps_2_0 ResolveOnly_PixelShader3(); // 25
ZEnable = 0;
ZWriteEnable = 0;
CullMode = 1;
AlphaBlendEnable = 0;
AlphaTestEnable = 0;
}
}
technique ResolveOnly_M
{
pass P0
{
VertexShader = compile vs_2_0 ResolveOnly_M_VertexShader2(); // 26
PixelShader = compile ps_2_0 ResolveOnly_M_PixelShader1(); // 27
ZEnable = 0;
ZWriteEnable = 0;
CullMode = 1;
AlphaBlendEnable = 0;
AlphaTestEnable = 0;
}
}