mirror of
https://mirror.ghproxy.com/https://github.com/dexyfex/CodeWalker
synced 2026-05-14 00:24:47 +08:00
Deferred shading
This commit is contained in:
@@ -1,64 +1,4 @@
|
||||
#include "Shadowmap.hlsli"
|
||||
|
||||
Texture2D<float4> Colourmap : register(t0);
|
||||
Texture2D<float4> Bumpmap : register(t2);
|
||||
Texture2D<float4> Specmap : register(t3);
|
||||
Texture2D<float4> Detailmap : register(t4);
|
||||
Texture2D<float4> Colourmap2 : register(t5);
|
||||
Texture2D<float4> TintPalette : register(t6);
|
||||
SamplerState TextureSS : register(s0);
|
||||
|
||||
|
||||
cbuffer PSSceneVars : register(b0)
|
||||
{
|
||||
ShaderGlobalLightParams GlobalLights;
|
||||
uint EnableShadows;
|
||||
uint RenderMode;//0=default, 1=normals, 2=tangents, 3=colours, 4=texcoords, 5=diffuse, 6=normalmap, 7=spec, 8=direct
|
||||
uint RenderModeIndex;
|
||||
uint RenderSamplerCoord;
|
||||
}
|
||||
cbuffer PSGeomVars : register(b2)
|
||||
{
|
||||
uint EnableTexture;//1+=diffuse1, 2+=diffuse2
|
||||
uint EnableTint;//1=default, 2=weapons (use diffuse.a for tint lookup)
|
||||
uint EnableNormalMap;
|
||||
uint EnableSpecMap;
|
||||
uint EnableDetailMap;
|
||||
uint IsDecal;
|
||||
uint IsEmissive;
|
||||
uint IsDistMap;
|
||||
float bumpiness;
|
||||
float AlphaScale;
|
||||
float HardAlphaBlend;
|
||||
float useTessellation;
|
||||
float4 detailSettings;
|
||||
float3 specMapIntMask;
|
||||
float specularIntensityMult;
|
||||
float specularFalloffMult;
|
||||
float specularFresnel;
|
||||
float wetnessMultiplier;
|
||||
uint SpecOnly;
|
||||
float4 TextureAlphaMask;
|
||||
}
|
||||
|
||||
|
||||
struct VS_OUTPUT
|
||||
{
|
||||
float4 Position : SV_POSITION;
|
||||
float3 Normal : NORMAL;
|
||||
float2 Texcoord0 : TEXCOORD0;
|
||||
float2 Texcoord1 : TEXCOORD1;
|
||||
float2 Texcoord2 : TEXCOORD2;
|
||||
float4 Shadows : TEXCOORD3;
|
||||
float4 LightShadow : TEXCOORD4;
|
||||
float4 Colour0 : COLOR0;
|
||||
float4 Colour1 : COLOR1;
|
||||
float4 Tint : COLOR2;
|
||||
float4 Tangent : TEXCOORD5;
|
||||
float4 Bitangent : TEXCOORD6;
|
||||
float3 CamRelPos : TEXCOORD7;
|
||||
};
|
||||
|
||||
#include "BasicPS.hlsli"
|
||||
|
||||
|
||||
float4 main(VS_OUTPUT input) : SV_TARGET
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
#include "Shadowmap.hlsli"
|
||||
|
||||
Texture2D<float4> Colourmap : register(t0);
|
||||
Texture2D<float4> Bumpmap : register(t2);
|
||||
Texture2D<float4> Specmap : register(t3);
|
||||
Texture2D<float4> Detailmap : register(t4);
|
||||
Texture2D<float4> Colourmap2 : register(t5);
|
||||
Texture2D<float4> TintPalette : register(t6);
|
||||
SamplerState TextureSS : register(s0);
|
||||
|
||||
|
||||
cbuffer PSSceneVars : register(b0)
|
||||
{
|
||||
ShaderGlobalLightParams GlobalLights;
|
||||
uint EnableShadows;
|
||||
uint RenderMode;//0=default, 1=normals, 2=tangents, 3=colours, 4=texcoords, 5=diffuse, 6=normalmap, 7=spec, 8=direct
|
||||
uint RenderModeIndex;
|
||||
uint RenderSamplerCoord;
|
||||
}
|
||||
cbuffer PSGeomVars : register(b2)
|
||||
{
|
||||
uint EnableTexture;//1+=diffuse1, 2+=diffuse2
|
||||
uint EnableTint;//1=default, 2=weapons (use diffuse.a for tint lookup)
|
||||
uint EnableNormalMap;
|
||||
uint EnableSpecMap;
|
||||
uint EnableDetailMap;
|
||||
uint IsDecal;
|
||||
uint IsEmissive;
|
||||
uint IsDistMap;
|
||||
float bumpiness;
|
||||
float AlphaScale;
|
||||
float HardAlphaBlend;
|
||||
float useTessellation;
|
||||
float4 detailSettings;
|
||||
float3 specMapIntMask;
|
||||
float specularIntensityMult;
|
||||
float specularFalloffMult;
|
||||
float specularFresnel;
|
||||
float wetnessMultiplier;
|
||||
uint SpecOnly;
|
||||
float4 TextureAlphaMask;
|
||||
}
|
||||
|
||||
|
||||
struct VS_OUTPUT
|
||||
{
|
||||
float4 Position : SV_POSITION;
|
||||
float3 Normal : NORMAL;
|
||||
float2 Texcoord0 : TEXCOORD0;
|
||||
float2 Texcoord1 : TEXCOORD1;
|
||||
float2 Texcoord2 : TEXCOORD2;
|
||||
float4 Shadows : TEXCOORD3;
|
||||
float4 LightShadow : TEXCOORD4;
|
||||
float4 Colour0 : COLOR0;
|
||||
float4 Colour1 : COLOR1;
|
||||
float4 Tint : COLOR2;
|
||||
float4 Tangent : TEXCOORD5;
|
||||
float4 Bitangent : TEXCOORD6;
|
||||
float3 CamRelPos : TEXCOORD7;
|
||||
};
|
||||
|
||||
struct PS_OUTPUT
|
||||
{
|
||||
float4 Diffuse : SV_Target0;
|
||||
float4 Normal : SV_Target1;
|
||||
float4 Specular : SV_Target2;
|
||||
float4 Irradiance : SV_Target3;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,171 @@
|
||||
#include "BasicPS.hlsli"
|
||||
|
||||
|
||||
PS_OUTPUT main(VS_OUTPUT input)
|
||||
{
|
||||
float4 c = float4(0.5, 0.5, 0.5, 1);
|
||||
if (RenderMode == 0) c = float4(1, 1, 1, 1);
|
||||
if (EnableTexture > 0)
|
||||
{
|
||||
float2 texc = input.Texcoord0;
|
||||
if (RenderMode >= 5)
|
||||
{
|
||||
if (RenderSamplerCoord == 2)
|
||||
texc = input.Texcoord1;
|
||||
else if (RenderSamplerCoord == 3)
|
||||
texc = input.Texcoord2;
|
||||
}
|
||||
|
||||
c = Colourmap.Sample(TextureSS, texc);
|
||||
|
||||
if (EnableTexture > 1) //2+ enables diffuse2
|
||||
{
|
||||
float4 c2 = Colourmap2.Sample(TextureSS, input.Texcoord1);
|
||||
c = c2.a * c2 + (1 - c2.a) * c;
|
||||
}
|
||||
if (EnableTint == 2)
|
||||
{
|
||||
//weapon tint
|
||||
float tx = (round(c.a * 255.009995) - 32.0) * 0.007813; //okay R* this is just silly
|
||||
float ty = 0.03125 * 0.5; // //1;//what to use for Y value? cb12[2].w in R* shader
|
||||
float4 c3 = TintPalette.Sample(TextureSS, float2(tx, ty));
|
||||
c.rgb *= c3.rgb;
|
||||
c.a = 1;
|
||||
}
|
||||
|
||||
if (IsDistMap) c = float4(c.rgb * 2, (c.r + c.g + c.b) - 1);
|
||||
if ((IsDecal == 0) && (c.a <= 0.33)) discard;
|
||||
if ((IsDecal == 1) && (c.a <= 0.0)) discard;
|
||||
if (IsDecal == 0) c.a = 1;
|
||||
if (IsDecal == 2)
|
||||
{
|
||||
float4 mask = TextureAlphaMask * c;
|
||||
c.a = saturate(mask.r + mask.g + mask.b + mask.a);
|
||||
c.rgb = 0;
|
||||
}
|
||||
c.a = saturate(c.a * AlphaScale);
|
||||
}
|
||||
if (EnableTint == 1)
|
||||
{
|
||||
c.rgb *= input.Tint.rgb;
|
||||
}
|
||||
if (IsDecal == 1)
|
||||
{
|
||||
c.a *= input.Colour0.a;
|
||||
}
|
||||
|
||||
float3 norm = normalize(input.Normal);
|
||||
|
||||
if (RenderMode == 1) //normals
|
||||
{
|
||||
c.rgb = norm * 0.5 + 0.5;
|
||||
}
|
||||
else if (RenderMode == 2) //tangents
|
||||
{
|
||||
c.rgb = normalize(input.Tangent.rgb) * 0.5 + 0.5;
|
||||
}
|
||||
else if (RenderMode == 3) //colours
|
||||
{
|
||||
c.rgb = input.Colour0.rgb;
|
||||
if (RenderModeIndex == 2)
|
||||
c.rgb = input.Colour1.rgb;
|
||||
}
|
||||
else if (RenderMode == 4) //texcoords
|
||||
{
|
||||
c.rgb = float3(input.Texcoord0, 0);
|
||||
if (RenderModeIndex == 2) c.rgb = float3(input.Texcoord1, 0);
|
||||
if (RenderModeIndex == 3) c.rgb = float3(input.Texcoord2, 0);
|
||||
}
|
||||
|
||||
|
||||
float3 spec = 0;
|
||||
|
||||
if (RenderMode == 0)
|
||||
{
|
||||
|
||||
float4 nv = Bumpmap.Sample(TextureSS, input.Texcoord0);
|
||||
float4 sv = Specmap.Sample(TextureSS, input.Texcoord0);
|
||||
|
||||
|
||||
float2 nmv = nv.xy;
|
||||
float4 r0 = 0, r1, r2, r3;
|
||||
|
||||
if (EnableNormalMap)
|
||||
{
|
||||
if (EnableDetailMap)
|
||||
{
|
||||
//detail normalmapp
|
||||
r0.xy = input.Texcoord0 * detailSettings.zw;
|
||||
r0.zw = r0.xy * 3.17;
|
||||
r0.xy = Detailmap.Sample(TextureSS, r0.xy).xy - 0.5;
|
||||
r0.zw = Detailmap.Sample(TextureSS, r0.zw).xy - 0.5;
|
||||
r0.xy = r0.xy + r0.zw;
|
||||
r0.yz = r0.xy * detailSettings.y; //r0.x = -r0.x*detailSettings.x;
|
||||
nmv = r0.yz * sv.w + nv.xy; //add detail to normal, using specmap(!)
|
||||
}
|
||||
|
||||
norm = NormalMap(nmv, bumpiness, input.Normal.xyz, input.Tangent.xyz, input.Bitangent.xyz);
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
if (EnableSpecMap == 0)
|
||||
{
|
||||
sv = float4(0.1, 0.1, 0.1, 0.1);
|
||||
}
|
||||
|
||||
float r1y = norm.z - 0.35;
|
||||
|
||||
float3 globalScalars = float3(0.5, 0.5, 0.5);
|
||||
float globalScalars2z = 1; // 0.65; //wet darkness?
|
||||
float wetness = 0; // 10.0;
|
||||
|
||||
r0.x = 0; // .5;
|
||||
r0.z = 1 - globalScalars2z;
|
||||
r0.y = saturate(r1y * 1.538462);
|
||||
r0.y = r0.y * wetness;
|
||||
r0.y = r0.y * r0.z;
|
||||
r1.yz = input.Colour0.xy * globalScalars.zy;
|
||||
r0.y = r0.y * r1.y;
|
||||
r0.x = r0.x * sv.w + 1.0;
|
||||
sv.xy = sv.xy * sv.xy;
|
||||
r0.z = sv.w * specularFalloffMult;
|
||||
r3.y = r0.z * 0.001953125; // (1/512)
|
||||
r0.z = dot(sv.xyz, specMapIntMask);
|
||||
r0.z = r0.z * specularIntensityMult;
|
||||
r3.x = r0.x * r0.z;
|
||||
r0.z = saturate(r0.z * r0.x + 0.4);
|
||||
r0.z = 1 - r3.x * 0.5;
|
||||
r0.z = r0.z * r0.y;
|
||||
r0.y = r0.y * wetnessMultiplier;
|
||||
r0.z = 1 - r0.z * 0.5;
|
||||
|
||||
float3 tc = c.rgb * r0.x;
|
||||
c.rgb = tc * r0.z; //diffuse factors...
|
||||
|
||||
|
||||
spec.xy = sqrt(r3.xy);
|
||||
spec.z = r0.z;
|
||||
|
||||
}
|
||||
|
||||
|
||||
float emiss = (IsEmissive == 1) ? 1.0 : 0.0;
|
||||
|
||||
c.a = saturate(c.a);
|
||||
|
||||
|
||||
|
||||
PS_OUTPUT output;
|
||||
output.Diffuse = c;
|
||||
output.Normal = float4(saturate(norm * 0.5 + 0.5), c.a);
|
||||
output.Specular = float4(spec, c.a);
|
||||
output.Irradiance = float4(input.Colour0.rg, emiss, c.a);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,41 +1,4 @@
|
||||
#include "Shadowmap.hlsli"
|
||||
|
||||
Texture2D<float4> Colourmap : register(t0);
|
||||
SamplerState TextureSS : register(s0);
|
||||
|
||||
|
||||
cbuffer PSSceneVars : register(b0)
|
||||
{
|
||||
ShaderGlobalLightParams GlobalLights;
|
||||
uint EnableShadows;
|
||||
uint RenderMode;//0=default, 1=normals, 2=tangents, 3=colours, 4=texcoords, 5=diffuse, 6=normalmap, 7=spec, 8=direct
|
||||
uint RenderModeIndex;
|
||||
uint RenderSamplerCoord;
|
||||
}
|
||||
cbuffer PSGeomVars : register(b2)
|
||||
{
|
||||
uint EnableTexture;
|
||||
uint EnableTint;
|
||||
uint Pad100;
|
||||
uint Pad101;
|
||||
}
|
||||
|
||||
|
||||
struct VS_OUTPUT
|
||||
{
|
||||
float4 Position : SV_POSITION;
|
||||
float3 Normal : NORMAL;
|
||||
float2 Texcoord0 : TEXCOORD0;
|
||||
float2 Texcoord1 : TEXCOORD1;
|
||||
float2 Texcoord2 : TEXCOORD2;
|
||||
float4 Shadows : TEXCOORD3;
|
||||
float4 LightShadow : TEXCOORD4;
|
||||
float4 Colour0 : COLOR0;
|
||||
float4 Colour1 : COLOR1;
|
||||
float4 Tint : COLOR2;
|
||||
float4 Tangent : TANGENT;
|
||||
};
|
||||
|
||||
#include "CablePS.hlsli"
|
||||
|
||||
|
||||
float4 main(VS_OUTPUT input) : SV_TARGET
|
||||
|
||||
@@ -0,0 +1,46 @@
|
||||
#include "Shadowmap.hlsli"
|
||||
|
||||
Texture2D<float4> Colourmap : register(t0);
|
||||
SamplerState TextureSS : register(s0);
|
||||
|
||||
|
||||
cbuffer PSSceneVars : register(b0)
|
||||
{
|
||||
ShaderGlobalLightParams GlobalLights;
|
||||
uint EnableShadows;
|
||||
uint RenderMode; //0=default, 1=normals, 2=tangents, 3=colours, 4=texcoords, 5=diffuse, 6=normalmap, 7=spec, 8=direct
|
||||
uint RenderModeIndex;
|
||||
uint RenderSamplerCoord;
|
||||
}
|
||||
cbuffer PSGeomVars : register(b2)
|
||||
{
|
||||
uint EnableTexture;
|
||||
uint EnableTint;
|
||||
uint Pad100;
|
||||
uint Pad101;
|
||||
}
|
||||
|
||||
|
||||
struct VS_OUTPUT
|
||||
{
|
||||
float4 Position : SV_POSITION;
|
||||
float3 Normal : NORMAL;
|
||||
float2 Texcoord0 : TEXCOORD0;
|
||||
float2 Texcoord1 : TEXCOORD1;
|
||||
float2 Texcoord2 : TEXCOORD2;
|
||||
float4 Shadows : TEXCOORD3;
|
||||
float4 LightShadow : TEXCOORD4;
|
||||
float4 Colour0 : COLOR0;
|
||||
float4 Colour1 : COLOR1;
|
||||
float4 Tint : COLOR2;
|
||||
float4 Tangent : TANGENT;
|
||||
};
|
||||
|
||||
struct PS_OUTPUT
|
||||
{
|
||||
float4 Diffuse : SV_Target0;
|
||||
float4 Normal : SV_Target1;
|
||||
float4 Specular : SV_Target2;
|
||||
float4 Irradiance : SV_Target3;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
#include "CablePS.hlsli"
|
||||
|
||||
|
||||
PS_OUTPUT main(VS_OUTPUT input)
|
||||
{
|
||||
float4 c = float4(0.2, 0.2, 0.2, 1);
|
||||
if (EnableTexture == 1)
|
||||
{
|
||||
float2 texc = input.Texcoord0;
|
||||
if (RenderMode >= 5)
|
||||
{
|
||||
if (RenderSamplerCoord == 2) texc = input.Texcoord1;
|
||||
else if (RenderSamplerCoord == 3) texc = input.Texcoord2;
|
||||
}
|
||||
|
||||
c = Colourmap.Sample(TextureSS, texc);
|
||||
//c = Depthmap.SampleLevel(DepthmapSS, input.Texcoord, 0); c.a = 1;
|
||||
//if ((IsDecal == 0) && (c.a <= 0.33)) discard;
|
||||
//if ((IsDecal == 1) && (c.a <= 0.0)) discard;
|
||||
//if(IsDecal==0) c.a = 1;
|
||||
c.a = 1;
|
||||
}
|
||||
//else //if(RenderMode!=8)//
|
||||
//{
|
||||
// c = float4(input.Colour0.rgb, 1);
|
||||
//}
|
||||
if (EnableTint > 0)
|
||||
{
|
||||
c.rgb *= input.Tint.rgb;
|
||||
}
|
||||
//if (IsDecal == 1)
|
||||
//{
|
||||
// c.a *= input.Colour0.a;
|
||||
//}
|
||||
|
||||
float3 norm = normalize(input.Normal);
|
||||
|
||||
if (RenderMode == 1) //normals
|
||||
{
|
||||
c.rgb = norm*0.5+0.5;
|
||||
}
|
||||
else if (RenderMode == 2) //tangents
|
||||
{
|
||||
c.rgb = normalize(input.Tangent.rgb)*0.5+0.5;
|
||||
}
|
||||
else if (RenderMode == 3) //colours
|
||||
{
|
||||
c.rgb = input.Colour0.rgb;
|
||||
if (RenderModeIndex == 2) c.rgb = input.Colour1.rgb;
|
||||
}
|
||||
else if (RenderMode == 4) //texcoords
|
||||
{
|
||||
c.rgb = float3(input.Texcoord0, 0);
|
||||
if (RenderModeIndex == 2) c.rgb = float3(input.Texcoord1, 0);
|
||||
if (RenderModeIndex == 3) c.rgb = float3(input.Texcoord2, 0);
|
||||
}
|
||||
|
||||
|
||||
|
||||
float3 spec = 0;
|
||||
|
||||
c.a = saturate(c.a);
|
||||
|
||||
PS_OUTPUT output;
|
||||
output.Diffuse = c;
|
||||
output.Normal = float4(saturate(norm * 0.5 + 0.5), c.a);
|
||||
output.Specular = float4(spec, c.a);
|
||||
output.Irradiance = float4(input.Colour0.rg, 0, c.a);
|
||||
|
||||
return output;
|
||||
}
|
||||
@@ -132,6 +132,16 @@
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicPS_Deferred.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Pixel</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Pixel</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_Box.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType>
|
||||
@@ -344,6 +354,16 @@
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
|
||||
</FxCompile>
|
||||
<FxCompile Include="CablePS_Deferred.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Pixel</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Pixel</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel>
|
||||
</FxCompile>
|
||||
<FxCompile Include="CableVS.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType>
|
||||
@@ -374,6 +394,26 @@
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Vertex</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Vertex</ShaderType>
|
||||
</FxCompile>
|
||||
<FxCompile Include="LightPS.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Pixel</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Pixel</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel>
|
||||
</FxCompile>
|
||||
<FxCompile Include="LightVS.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Vertex</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel>
|
||||
</FxCompile>
|
||||
<FxCompile Include="MarkerPS.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Pixel</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Pixel</ShaderType>
|
||||
@@ -548,6 +588,16 @@
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
|
||||
</FxCompile>
|
||||
<FxCompile Include="TerrainPS_Deferred.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Pixel</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Pixel</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel>
|
||||
</FxCompile>
|
||||
<FxCompile Include="TerrainVS_PNCCT.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Vertex</ShaderType>
|
||||
@@ -596,6 +646,16 @@
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
|
||||
</FxCompile>
|
||||
<FxCompile Include="TreesLodPS_Deferred.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Pixel</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Pixel</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel>
|
||||
</FxCompile>
|
||||
<FxCompile Include="TreesLodVS.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType>
|
||||
@@ -608,6 +668,16 @@
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
|
||||
</FxCompile>
|
||||
<FxCompile Include="WaterPS_Deferred.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Pixel</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Pixel</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Pixel</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4.0</ShaderModel>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Pixel</ShaderType>
|
||||
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">4.0</ShaderModel>
|
||||
</FxCompile>
|
||||
<FxCompile Include="WaterVS_PCT.hlsl">
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType>
|
||||
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType>
|
||||
@@ -646,13 +716,18 @@
|
||||
</FxCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="BasicPS.hlsli" />
|
||||
<None Include="BasicVS.hlsli" />
|
||||
<None Include="CablePS.hlsli" />
|
||||
<None Include="Clouds.hlsli" />
|
||||
<None Include="Common.hlsli" />
|
||||
<None Include="Quaternion.hlsli" />
|
||||
<None Include="Shadowmap.hlsli" />
|
||||
<None Include="Skydome.hlsli" />
|
||||
<None Include="TerrainPS.hlsli" />
|
||||
<None Include="TerrainVS.hlsli" />
|
||||
<None Include="TreesLodPS.hlsli" />
|
||||
<None Include="WaterPS.hlsli" />
|
||||
<None Include="WaterVS.hlsli" />
|
||||
</ItemGroup>
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||
|
||||
@@ -1,90 +1,336 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<ItemGroup>
|
||||
<FxCompile Include="BasicPS.hlsl" />
|
||||
<FxCompile Include="TerrainPS.hlsl" />
|
||||
<FxCompile Include="TerrainVS_PNCTTX.hlsl" />
|
||||
<FxCompile Include="TerrainVS_PNCCT.hlsl" />
|
||||
<FxCompile Include="TerrainVS_PNCCTT.hlsl" />
|
||||
<FxCompile Include="TerrainVS_PNCCTTTX.hlsl" />
|
||||
<FxCompile Include="TerrainVS_PNCCTTX.hlsl" />
|
||||
<FxCompile Include="TerrainVS_PNCCTX.hlsl" />
|
||||
<FxCompile Include="TerrainVS_PNCTTTX.hlsl" />
|
||||
<FxCompile Include="MarkerVS.hlsl" />
|
||||
<FxCompile Include="MarkerPS.hlsl" />
|
||||
<FxCompile Include="SkydomeVS.hlsl" />
|
||||
<FxCompile Include="SkydomePS.hlsl" />
|
||||
<FxCompile Include="BoundingSphereVS.hlsl" />
|
||||
<FxCompile Include="BoundsPS.hlsl" />
|
||||
<FxCompile Include="BoundingBoxVS.hlsl" />
|
||||
<FxCompile Include="TreesLodVS.hlsl" />
|
||||
<FxCompile Include="TreesLodPS.hlsl" />
|
||||
<FxCompile Include="ShadowVS.hlsl" />
|
||||
<FxCompile Include="ShadowPS.hlsl" />
|
||||
<FxCompile Include="BasicVS_PNCT.hlsl" />
|
||||
<FxCompile Include="BasicVS_PNCTT.hlsl" />
|
||||
<FxCompile Include="BasicVS_PNCTX.hlsl" />
|
||||
<FxCompile Include="BasicVS_PNCCT.hlsl" />
|
||||
<FxCompile Include="BasicVS_PNCCTT.hlsl" />
|
||||
<FxCompile Include="BasicVS_PNCCTTT.hlsl" />
|
||||
<FxCompile Include="BasicVS_PNCCTX.hlsl" />
|
||||
<FxCompile Include="BasicVS_PNCTTX.hlsl" />
|
||||
<FxCompile Include="BasicVS_PNCCTTX.hlsl" />
|
||||
<FxCompile Include="BasicVS_PNCTTTX.hlsl" />
|
||||
<FxCompile Include="BasicVS_PNCCTTTX.hlsl" />
|
||||
<FxCompile Include="BasicVS_Box.hlsl" />
|
||||
<FxCompile Include="BasicVS_Sphere.hlsl" />
|
||||
<FxCompile Include="BasicVS_Capsule.hlsl" />
|
||||
<FxCompile Include="BasicVS_Cylinder.hlsl" />
|
||||
<FxCompile Include="CableVS.hlsl" />
|
||||
<FxCompile Include="CablePS.hlsl" />
|
||||
<FxCompile Include="DistantLightsVS.hlsl" />
|
||||
<FxCompile Include="DistantLightsPS.hlsl" />
|
||||
<FxCompile Include="PPBloomFilterBPHCS.hlsl" />
|
||||
<FxCompile Include="PPBloomFilterVCS.hlsl" />
|
||||
<FxCompile Include="PPCopyPixelsPS.hlsl" />
|
||||
<FxCompile Include="PPFinalPassPS.hlsl" />
|
||||
<FxCompile Include="PPFinalPassVS.hlsl" />
|
||||
<FxCompile Include="PPLumBlendCS.hlsl" />
|
||||
<FxCompile Include="PPReduceTo0DCS.hlsl" />
|
||||
<FxCompile Include="PPReduceTo1DCS.hlsl" />
|
||||
<FxCompile Include="SkySunVS.hlsl" />
|
||||
<FxCompile Include="SkySunPS.hlsl" />
|
||||
<FxCompile Include="CloudsVS.hlsl" />
|
||||
<FxCompile Include="CloudsPS.hlsl" />
|
||||
<FxCompile Include="WaterVS_PNCT.hlsl" />
|
||||
<FxCompile Include="WaterVS_PNCTX.hlsl" />
|
||||
<FxCompile Include="WaterPS.hlsl" />
|
||||
<FxCompile Include="WaterVS_PT.hlsl" />
|
||||
<FxCompile Include="WaterVS_PCT.hlsl" />
|
||||
<FxCompile Include="PathVS.hlsl" />
|
||||
<FxCompile Include="PathPS.hlsl" />
|
||||
<FxCompile Include="WidgetVS.hlsl" />
|
||||
<FxCompile Include="WidgetPS.hlsl" />
|
||||
<FxCompile Include="PathBoxVS.hlsl" />
|
||||
<FxCompile Include="PathBoxPS.hlsl" />
|
||||
<FxCompile Include="SkyMoonVS.hlsl" />
|
||||
<FxCompile Include="SkyMoonPS.hlsl" />
|
||||
<FxCompile Include="PathDynVS.hlsl" />
|
||||
<FxCompile Include="BasicVS_PBBNCT.hlsl" />
|
||||
<FxCompile Include="BasicVS_PBBNCTX.hlsl" />
|
||||
<FxCompile Include="BasicVS_PBBNCTT.hlsl" />
|
||||
<FxCompile Include="BasicVS_PBBNCTTT.hlsl" />
|
||||
<FxCompile Include="BasicVS_PNCTTT.hlsl" />
|
||||
<FxCompile Include="BasicVS_PBBNCCT.hlsl" />
|
||||
<FxCompile Include="BasicVS_PBBNCCTX.hlsl" />
|
||||
<FxCompile Include="BasicVS_PBBNCTTX.hlsl" />
|
||||
<FxCompile Include="ShadowVS_Skin.hlsl" />
|
||||
<FxCompile Include="BasicVS_PBBNCCTTX.hlsl" />
|
||||
<FxCompile Include="BasicPS.hlsl">
|
||||
<Filter>Basic</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicPS_Deferred.hlsl">
|
||||
<Filter>Basic</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_Box.hlsl">
|
||||
<Filter>Basic</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_Capsule.hlsl">
|
||||
<Filter>Basic</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_Cylinder.hlsl">
|
||||
<Filter>Basic</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_PBBNCCT.hlsl">
|
||||
<Filter>Basic</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_PBBNCCTTX.hlsl">
|
||||
<Filter>Basic</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_PBBNCCTX.hlsl">
|
||||
<Filter>Basic</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_PBBNCT.hlsl">
|
||||
<Filter>Basic</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_PBBNCTT.hlsl">
|
||||
<Filter>Basic</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_PBBNCTTT.hlsl">
|
||||
<Filter>Basic</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_PBBNCTTX.hlsl">
|
||||
<Filter>Basic</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_PBBNCTX.hlsl">
|
||||
<Filter>Basic</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_PNCCT.hlsl">
|
||||
<Filter>Basic</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_PNCCTT.hlsl">
|
||||
<Filter>Basic</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_PNCCTTT.hlsl">
|
||||
<Filter>Basic</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_PNCCTTTX.hlsl">
|
||||
<Filter>Basic</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_PNCCTTX.hlsl">
|
||||
<Filter>Basic</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_PNCCTX.hlsl">
|
||||
<Filter>Basic</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_PNCT.hlsl">
|
||||
<Filter>Basic</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_PNCTT.hlsl">
|
||||
<Filter>Basic</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_PNCTTT.hlsl">
|
||||
<Filter>Basic</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_PNCTTTX.hlsl">
|
||||
<Filter>Basic</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_PNCTTX.hlsl">
|
||||
<Filter>Basic</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_PNCTX.hlsl">
|
||||
<Filter>Basic</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BasicVS_Sphere.hlsl">
|
||||
<Filter>Basic</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BoundsPS.hlsl">
|
||||
<Filter>Bounds</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BoundingBoxVS.hlsl">
|
||||
<Filter>Bounds</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="BoundingSphereVS.hlsl">
|
||||
<Filter>Bounds</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="CablePS.hlsl">
|
||||
<Filter>Cable</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="CablePS_Deferred.hlsl">
|
||||
<Filter>Cable</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="CableVS.hlsl">
|
||||
<Filter>Cable</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="CloudsPS.hlsl">
|
||||
<Filter>Sky</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="CloudsVS.hlsl">
|
||||
<Filter>Sky</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="SkydomePS.hlsl">
|
||||
<Filter>Sky</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="SkydomeVS.hlsl">
|
||||
<Filter>Sky</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="SkyMoonPS.hlsl">
|
||||
<Filter>Sky</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="SkyMoonVS.hlsl">
|
||||
<Filter>Sky</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="SkySunPS.hlsl">
|
||||
<Filter>Sky</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="SkySunVS.hlsl">
|
||||
<Filter>Sky</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="MarkerPS.hlsl">
|
||||
<Filter>Markers</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="MarkerVS.hlsl">
|
||||
<Filter>Markers</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="PathBoxPS.hlsl">
|
||||
<Filter>Paths</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="PathBoxVS.hlsl">
|
||||
<Filter>Paths</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="PathDynVS.hlsl">
|
||||
<Filter>Paths</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="PathPS.hlsl">
|
||||
<Filter>Paths</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="PathVS.hlsl">
|
||||
<Filter>Paths</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="PPBloomFilterBPHCS.hlsl">
|
||||
<Filter>PostProcessor</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="PPBloomFilterVCS.hlsl">
|
||||
<Filter>PostProcessor</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="PPCopyPixelsPS.hlsl">
|
||||
<Filter>PostProcessor</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="PPFinalPassPS.hlsl">
|
||||
<Filter>PostProcessor</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="PPFinalPassVS.hlsl">
|
||||
<Filter>PostProcessor</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="PPLumBlendCS.hlsl">
|
||||
<Filter>PostProcessor</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="PPReduceTo0DCS.hlsl">
|
||||
<Filter>PostProcessor</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="PPReduceTo1DCS.hlsl">
|
||||
<Filter>PostProcessor</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="ShadowPS.hlsl">
|
||||
<Filter>Shadows</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="ShadowVS.hlsl">
|
||||
<Filter>Shadows</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="ShadowVS_Skin.hlsl">
|
||||
<Filter>Shadows</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="TerrainPS.hlsl">
|
||||
<Filter>Terrain</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="TerrainPS_Deferred.hlsl">
|
||||
<Filter>Terrain</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="TerrainVS_PNCCT.hlsl">
|
||||
<Filter>Terrain</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="TerrainVS_PNCCTT.hlsl">
|
||||
<Filter>Terrain</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="TerrainVS_PNCCTTTX.hlsl">
|
||||
<Filter>Terrain</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="TerrainVS_PNCCTTX.hlsl">
|
||||
<Filter>Terrain</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="TerrainVS_PNCCTX.hlsl">
|
||||
<Filter>Terrain</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="TerrainVS_PNCTTTX.hlsl">
|
||||
<Filter>Terrain</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="TerrainVS_PNCTTX.hlsl">
|
||||
<Filter>Terrain</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="TreesLodPS.hlsl">
|
||||
<Filter>Trees</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="TreesLodPS_Deferred.hlsl">
|
||||
<Filter>Trees</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="TreesLodVS.hlsl">
|
||||
<Filter>Trees</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="WaterPS.hlsl">
|
||||
<Filter>Water</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="WaterPS_Deferred.hlsl">
|
||||
<Filter>Water</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="WaterVS_PCT.hlsl">
|
||||
<Filter>Water</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="WaterVS_PNCT.hlsl">
|
||||
<Filter>Water</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="WaterVS_PNCTX.hlsl">
|
||||
<Filter>Water</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="WaterVS_PT.hlsl">
|
||||
<Filter>Water</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="WidgetPS.hlsl">
|
||||
<Filter>Widget</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="WidgetVS.hlsl">
|
||||
<Filter>Widget</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="LightPS.hlsl">
|
||||
<Filter>Lights</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="LightVS.hlsl">
|
||||
<Filter>Lights</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="DistantLightsPS.hlsl">
|
||||
<Filter>Lights</Filter>
|
||||
</FxCompile>
|
||||
<FxCompile Include="DistantLightsVS.hlsl">
|
||||
<Filter>Lights</Filter>
|
||||
</FxCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="Quaternion.hlsli" />
|
||||
<None Include="Common.hlsli" />
|
||||
<None Include="Shadowmap.hlsli" />
|
||||
<None Include="TerrainVS.hlsli" />
|
||||
<None Include="BasicVS.hlsli" />
|
||||
<None Include="Skydome.hlsli" />
|
||||
<None Include="Clouds.hlsli" />
|
||||
<None Include="WaterVS.hlsli" />
|
||||
<None Include="BasicPS.hlsli">
|
||||
<Filter>Basic</Filter>
|
||||
</None>
|
||||
<None Include="BasicVS.hlsli">
|
||||
<Filter>Basic</Filter>
|
||||
</None>
|
||||
<None Include="CablePS.hlsli">
|
||||
<Filter>Cable</Filter>
|
||||
</None>
|
||||
<None Include="Clouds.hlsli">
|
||||
<Filter>Sky</Filter>
|
||||
</None>
|
||||
<None Include="Skydome.hlsli">
|
||||
<Filter>Sky</Filter>
|
||||
</None>
|
||||
<None Include="Common.hlsli">
|
||||
<Filter>Common</Filter>
|
||||
</None>
|
||||
<None Include="Quaternion.hlsli">
|
||||
<Filter>Common</Filter>
|
||||
</None>
|
||||
<None Include="Shadowmap.hlsli">
|
||||
<Filter>Shadows</Filter>
|
||||
</None>
|
||||
<None Include="TerrainPS.hlsli">
|
||||
<Filter>Terrain</Filter>
|
||||
</None>
|
||||
<None Include="TerrainVS.hlsli">
|
||||
<Filter>Terrain</Filter>
|
||||
</None>
|
||||
<None Include="TreesLodPS.hlsli">
|
||||
<Filter>Trees</Filter>
|
||||
</None>
|
||||
<None Include="WaterPS.hlsli">
|
||||
<Filter>Water</Filter>
|
||||
</None>
|
||||
<None Include="WaterVS.hlsli">
|
||||
<Filter>Water</Filter>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Filter Include="Basic">
|
||||
<UniqueIdentifier>{2d5fa9c1-ac2c-4820-b3a2-e3417e5b4a75}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Bounds">
|
||||
<UniqueIdentifier>{7b12481e-7e7c-45a2-aa19-26cf35acf33d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Cable">
|
||||
<UniqueIdentifier>{2fa3ba6e-67fe-49a0-bd2c-2b3b45702285}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Sky">
|
||||
<UniqueIdentifier>{5fdc8b34-5e82-4786-9d6d-1af2248575b2}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Common">
|
||||
<UniqueIdentifier>{0b5779e8-ab81-41e3-88e4-849c66a7a171}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Markers">
|
||||
<UniqueIdentifier>{8f404e01-a627-4d6d-9037-c073a687d61d}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Paths">
|
||||
<UniqueIdentifier>{6d63039e-7ce7-48f9-a503-76ec3782b5b0}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="PostProcessor">
|
||||
<UniqueIdentifier>{1d840a5b-3c41-4c7a-a363-6607e269b27b}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Shadows">
|
||||
<UniqueIdentifier>{baaa8dee-0bc4-4b05-95a1-882640344212}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Terrain">
|
||||
<UniqueIdentifier>{03608a54-3337-4feb-b010-3a454a02c4c0}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Trees">
|
||||
<UniqueIdentifier>{f43e28c7-ea51-4960-a602-db412ac6bd2a}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Water">
|
||||
<UniqueIdentifier>{342884aa-960f-460a-9d63-93cacab48de5}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Widget">
|
||||
<UniqueIdentifier>{160d1dee-4be7-43ad-a6a8-511a8bb13865}</UniqueIdentifier>
|
||||
</Filter>
|
||||
<Filter Include="Lights">
|
||||
<UniqueIdentifier>{215eb704-917e-43c0-8d5b-d24e75403db3}</UniqueIdentifier>
|
||||
</Filter>
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -139,7 +139,7 @@ float3 GlobalLighting(float3 diff, float3 norm, float4 vc0, float lf, uniform Sh
|
||||
{
|
||||
float3 c = saturate(diff);
|
||||
float3 fc = c;
|
||||
float naturalDiffuseFactor = 1.0;
|
||||
float naturalDiffuseFactor = vc0.r;
|
||||
float artificialDiffuseFactor = saturate(vc0.g);
|
||||
c *= BasicLighting(globalLights.LightDirColour, globalLights.LightDirAmbColour, lf);
|
||||
c += AmbientLight(fc, norm.z, globalLights.LightNaturalAmbUp, globalLights.LightNaturalAmbDown, naturalDiffuseFactor);
|
||||
|
||||
@@ -0,0 +1,161 @@
|
||||
#include "Shadowmap.hlsli"
|
||||
|
||||
|
||||
struct LODLight
|
||||
{
|
||||
float3 Position;
|
||||
uint Colour;
|
||||
float3 Direction;
|
||||
uint TimeAndStateFlags;
|
||||
float4 TangentX;
|
||||
float4 TangentY;
|
||||
float Falloff;
|
||||
float FalloffExponent;
|
||||
float InnerAngle; //for cone
|
||||
float OuterAngleOrCapExt; //outer angle for cone, cap extent for capsule
|
||||
};
|
||||
|
||||
struct VS_Output
|
||||
{
|
||||
float4 Pos : SV_POSITION;
|
||||
float4 Screen : TEXCOORD0;
|
||||
uint IID : SV_INSTANCEID;
|
||||
};
|
||||
|
||||
struct PS_OUTPUT
|
||||
{
|
||||
float4 Colour : SV_TARGET;
|
||||
float Depth : SV_DEPTH;
|
||||
};
|
||||
|
||||
|
||||
Texture2D DepthTex : register(t0);
|
||||
Texture2D DiffuseTex : register(t2);
|
||||
Texture2D NormalTex : register(t3);
|
||||
Texture2D SpecularTex : register(t4);
|
||||
Texture2D IrradianceTex : register(t5);
|
||||
|
||||
|
||||
|
||||
cbuffer PSLightVars : register(b0)
|
||||
{
|
||||
ShaderGlobalLightParams GlobalLights;
|
||||
float4x4 ViewProjInv;
|
||||
float4 CameraPos;
|
||||
uint EnableShadows;
|
||||
uint RenderMode; //0=default, 1=normals, 2=tangents, 3=colours, 4=texcoords, 5=diffuse, 6=normalmap, 7=spec, 8=direct
|
||||
uint RenderModeIndex;
|
||||
uint RenderSamplerCoord;
|
||||
uint LightType; //0=directional, 1=Point, 2=Spot, 4=Capsule
|
||||
uint IsLOD; //useful or not?
|
||||
uint Pad0;
|
||||
uint Pad1;
|
||||
}
|
||||
|
||||
StructuredBuffer<LODLight> LODLights : register(t6);
|
||||
|
||||
|
||||
|
||||
|
||||
PS_OUTPUT main(VS_Output input)
|
||||
{
|
||||
PS_OUTPUT output;
|
||||
output.Depth = input.Pos.z;
|
||||
|
||||
uint3 ssloc = uint3(input.Pos.xy, 0); //pixel location
|
||||
float depth = DepthTex.Load(ssloc).r;
|
||||
float4 diffuse = DiffuseTex.Load(ssloc);
|
||||
float4 normal = NormalTex.Load(ssloc);
|
||||
float4 specular = SpecularTex.Load(ssloc);
|
||||
float4 irradiance = IrradianceTex.Load(ssloc);
|
||||
|
||||
if (depth == 0) discard; //no existing pixel rendered here
|
||||
|
||||
switch (RenderMode)
|
||||
{
|
||||
case 5: output.Colour = float4(diffuse.rgb, 1); return output;
|
||||
case 6: output.Colour = float4(normal.rgb, 1); return output;
|
||||
case 7: output.Colour = float4(specular.rgb, 1); return output;
|
||||
}
|
||||
|
||||
|
||||
float4 spos = float4(input.Screen.xy/input.Screen.w, depth, 1);
|
||||
float4 cpos = mul(spos, ViewProjInv);
|
||||
float3 camRel = cpos.xyz * (1/cpos.w);
|
||||
|
||||
float3 norm = normal.xyz * 2 - 1;
|
||||
|
||||
float3 incident = normalize(camRel);
|
||||
float3 refl = normalize(reflect(incident, norm));
|
||||
|
||||
if (LightType == 0) //directional light
|
||||
{
|
||||
float specb = saturate(dot(refl, GlobalLights.LightDir));
|
||||
float specp = max(exp(specb * 10) - 1, 0);
|
||||
float3 spec = GlobalLights.LightDirColour.rgb * 0.00006 * specp * specular.r;
|
||||
float4 lightspacepos;
|
||||
float shadowdepth = ShadowmapSceneDepth(camRel, lightspacepos);
|
||||
float3 c = FullLighting(diffuse.rgb, spec, norm, irradiance, GlobalLights, EnableShadows, shadowdepth, lightspacepos);
|
||||
|
||||
c += diffuse.rgb * irradiance.b;//emissive multiplier
|
||||
|
||||
PS_OUTPUT output;
|
||||
output.Colour = float4(c, 1);
|
||||
output.Depth = depth;
|
||||
return output;
|
||||
}
|
||||
|
||||
float3 wpos = camRel + CameraPos.xyz;
|
||||
|
||||
LODLight lodlight = LODLights[input.IID];
|
||||
float3 srpos = lodlight.Position - wpos; //light position relative to surface position
|
||||
float ldist = length(srpos);
|
||||
if (ldist > lodlight.Falloff) discard; //out of range of the light... TODO: capsules!
|
||||
if (ldist <= 0) discard;
|
||||
|
||||
float4 rgbi = Unpack4x8UNF(lodlight.Colour).gbar;
|
||||
float3 lcol = rgbi.rgb * rgbi.a * 5.0f;
|
||||
|
||||
float3 ldir = srpos / ldist;
|
||||
float pclit = saturate(dot(ldir, norm));
|
||||
float lamt = 1;
|
||||
|
||||
if (LightType == 1)//point (sphere)
|
||||
{
|
||||
lamt *= saturate(1 - (ldist / lodlight.Falloff));
|
||||
}
|
||||
else if (LightType == 2)//spot (cone)
|
||||
{
|
||||
float ang = acos(-dot(ldir, lodlight.Direction));
|
||||
float iang = lodlight.InnerAngle * 0.01745329;
|
||||
float oang = lodlight.OuterAngleOrCapExt * 0.01745329 * 0.5;
|
||||
if (ang > oang) discard;
|
||||
lamt *= saturate(1 - ((ang - iang) / (oang - iang)));
|
||||
lamt *= saturate(1 - (ldist / lodlight.Falloff));
|
||||
}
|
||||
else if (LightType == 4)//capsule
|
||||
{
|
||||
lamt *= saturate(1 - (ldist / lodlight.Falloff)); //TODO! proper capsule lighting... (use point-line dist!)
|
||||
}
|
||||
|
||||
pclit *= lamt;
|
||||
|
||||
if (pclit <= 0) discard;
|
||||
|
||||
float specb = saturate(dot(refl, ldir));
|
||||
float specp = max(exp(specb * 10) - 1, 0);
|
||||
float3 spec = lcol * (0.00006 * specp * specular.r * lamt);
|
||||
|
||||
|
||||
lcol = lcol * diffuse.rgb * pclit + spec;
|
||||
|
||||
|
||||
output.Colour = float4(lcol, 0.5);
|
||||
return output;
|
||||
|
||||
//return float4(diffuse.rgb, 1);
|
||||
//return float4(normal.rgb, 1);
|
||||
//return float4(specular.rgb, 1);
|
||||
//return float4(irradiance.rgb, 1);
|
||||
}
|
||||
|
||||
@@ -0,0 +1,76 @@
|
||||
#include "Common.hlsli"
|
||||
|
||||
|
||||
struct LODLight
|
||||
{
|
||||
float3 Position;
|
||||
uint Colour;
|
||||
float3 Direction;
|
||||
uint TimeAndStateFlags;
|
||||
float4 TangentX;
|
||||
float4 TangentY;
|
||||
float Falloff;
|
||||
float FalloffExponent;
|
||||
float InnerAngle; //for cone
|
||||
float OuterAngleOrCapExt; //outer angle for cone, cap extent for capsule
|
||||
};
|
||||
|
||||
struct VS_Output
|
||||
{
|
||||
float4 Pos : SV_POSITION;
|
||||
float4 Screen : TEXCOORD0;
|
||||
uint IID : SV_INSTANCEID;
|
||||
};
|
||||
|
||||
|
||||
cbuffer VSLightVars : register(b0)
|
||||
{
|
||||
float4x4 ViewProj;
|
||||
float4 CameraPos;
|
||||
uint LightType; //0=directional, 1=Point, 2=Spot, 4=Capsule
|
||||
uint IsLOD; //useful or not?
|
||||
uint Pad0;
|
||||
uint Pad1;
|
||||
}
|
||||
|
||||
StructuredBuffer<LODLight> LODLights : register(t0);
|
||||
|
||||
|
||||
VS_Output main(float4 ipos : POSITION, uint iid : SV_InstanceID)
|
||||
{
|
||||
float3 opos = 0;
|
||||
if (LightType > 0)
|
||||
{
|
||||
LODLight lodlight = LODLights[iid];
|
||||
float extent = lodlight.Falloff;
|
||||
|
||||
if (LightType == 1)//point (sphere)
|
||||
{
|
||||
opos = ipos.xyz * extent;
|
||||
}
|
||||
else if (LightType == 2)//spot (cone)
|
||||
{
|
||||
float arads = lodlight.OuterAngleOrCapExt * 0.01745329 * 1.5;//is this right?
|
||||
float3 cpos = ipos.xyz * (atan(arads) * extent);
|
||||
cpos.y += ipos.w * extent;
|
||||
opos = (cpos.x * lodlight.TangentX.xyz) + (cpos.y * lodlight.Direction.xyz) + (cpos.z * lodlight.TangentY.xyz);
|
||||
}
|
||||
else if (LightType == 4)//capsule
|
||||
{
|
||||
float3 cpos = ipos.xyz * extent;
|
||||
cpos.y += (ipos.w*2-1) * lodlight.OuterAngleOrCapExt * 0.1;
|
||||
opos = (cpos.x * lodlight.TangentX.xyz) + (cpos.y * lodlight.Direction.xyz) + (cpos.z * lodlight.TangentY.xyz);
|
||||
}
|
||||
opos += (lodlight.Position - CameraPos.xyz);
|
||||
}
|
||||
else
|
||||
{
|
||||
opos = ipos.xyz;
|
||||
}
|
||||
float4 spos = mul(float4(opos, 1), ViewProj);
|
||||
VS_Output output;
|
||||
output.Pos = spos;
|
||||
output.Screen = spos;
|
||||
output.IID = iid;
|
||||
return output;
|
||||
}
|
||||
@@ -1,61 +1,4 @@
|
||||
#include "Shadowmap.hlsli"
|
||||
|
||||
Texture2D<float4> Colourmap0 : register(t0);
|
||||
Texture2D<float4> Colourmap1 : register(t2);
|
||||
Texture2D<float4> Colourmap2 : register(t3);
|
||||
Texture2D<float4> Colourmap3 : register(t4);
|
||||
Texture2D<float4> Colourmap4 : register(t5);
|
||||
Texture2D<float4> Colourmask : register(t6);
|
||||
Texture2D<float4> Normalmap0 : register(t7);
|
||||
Texture2D<float4> Normalmap1 : register(t8);
|
||||
Texture2D<float4> Normalmap2 : register(t9);
|
||||
Texture2D<float4> Normalmap3 : register(t10);
|
||||
Texture2D<float4> Normalmap4 : register(t11);
|
||||
SamplerState TextureSS : register(s0);
|
||||
|
||||
|
||||
cbuffer PSSceneVars : register(b0)
|
||||
{
|
||||
ShaderGlobalLightParams GlobalLights;
|
||||
uint EnableShadows;
|
||||
uint RenderMode; //0=default, 1=normals, 2=tangents, 3=colours, 4=texcoords, 5=diffuse, 6=normalmap, 7=spec, 8=direct
|
||||
uint RenderModeIndex; //colour or texcoord index
|
||||
uint RenderSamplerCoord;
|
||||
}
|
||||
cbuffer PSEntityVars : register(b2)
|
||||
{
|
||||
uint EnableTexture0;
|
||||
uint EnableTexture1;
|
||||
uint EnableTexture2;
|
||||
uint EnableTexture3;
|
||||
uint EnableTexture4;
|
||||
uint EnableTextureMask;
|
||||
uint EnableNormalMap;
|
||||
uint ShaderName;
|
||||
uint EnableTint;
|
||||
uint EnableVertexColour;
|
||||
float bumpiness;
|
||||
uint Pad102;
|
||||
}
|
||||
|
||||
|
||||
struct VS_OUTPUT
|
||||
{
|
||||
float4 Position : SV_POSITION;
|
||||
float3 Normal : NORMAL;
|
||||
float4 Colour0 : COLOR0;
|
||||
float4 Colour1 : COLOR1;
|
||||
float4 Tint : COLOR2;
|
||||
float2 Texcoord0 : TEXCOORD0;
|
||||
float2 Texcoord1 : TEXCOORD1;
|
||||
float2 Texcoord2 : TEXCOORD2;
|
||||
float4 Shadows : TEXCOORD4;
|
||||
float4 LightShadow : TEXCOORD5;
|
||||
float4 Tangent : TEXCOORD6;
|
||||
float4 Bitangent : TEXCOORD7;
|
||||
float3 CamRelPos : TEXCOORD8;
|
||||
};
|
||||
|
||||
#include "TerrainPS.hlsli"
|
||||
|
||||
|
||||
float4 main(VS_OUTPUT input) : SV_TARGET
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
#include "Shadowmap.hlsli"
|
||||
|
||||
Texture2D<float4> Colourmap0 : register(t0);
|
||||
Texture2D<float4> Colourmap1 : register(t2);
|
||||
Texture2D<float4> Colourmap2 : register(t3);
|
||||
Texture2D<float4> Colourmap3 : register(t4);
|
||||
Texture2D<float4> Colourmap4 : register(t5);
|
||||
Texture2D<float4> Colourmask : register(t6);
|
||||
Texture2D<float4> Normalmap0 : register(t7);
|
||||
Texture2D<float4> Normalmap1 : register(t8);
|
||||
Texture2D<float4> Normalmap2 : register(t9);
|
||||
Texture2D<float4> Normalmap3 : register(t10);
|
||||
Texture2D<float4> Normalmap4 : register(t11);
|
||||
SamplerState TextureSS : register(s0);
|
||||
|
||||
|
||||
cbuffer PSSceneVars : register(b0)
|
||||
{
|
||||
ShaderGlobalLightParams GlobalLights;
|
||||
uint EnableShadows;
|
||||
uint RenderMode; //0=default, 1=normals, 2=tangents, 3=colours, 4=texcoords, 5=diffuse, 6=normalmap, 7=spec, 8=direct
|
||||
uint RenderModeIndex; //colour or texcoord index
|
||||
uint RenderSamplerCoord;
|
||||
}
|
||||
cbuffer PSEntityVars : register(b2)
|
||||
{
|
||||
uint EnableTexture0;
|
||||
uint EnableTexture1;
|
||||
uint EnableTexture2;
|
||||
uint EnableTexture3;
|
||||
uint EnableTexture4;
|
||||
uint EnableTextureMask;
|
||||
uint EnableNormalMap;
|
||||
uint ShaderName;
|
||||
uint EnableTint;
|
||||
uint EnableVertexColour;
|
||||
float bumpiness;
|
||||
uint Pad102;
|
||||
}
|
||||
|
||||
|
||||
struct VS_OUTPUT
|
||||
{
|
||||
float4 Position : SV_POSITION;
|
||||
float3 Normal : NORMAL;
|
||||
float4 Colour0 : COLOR0;
|
||||
float4 Colour1 : COLOR1;
|
||||
float4 Tint : COLOR2;
|
||||
float2 Texcoord0 : TEXCOORD0;
|
||||
float2 Texcoord1 : TEXCOORD1;
|
||||
float2 Texcoord2 : TEXCOORD2;
|
||||
float4 Shadows : TEXCOORD4;
|
||||
float4 LightShadow : TEXCOORD5;
|
||||
float4 Tangent : TEXCOORD6;
|
||||
float4 Bitangent : TEXCOORD7;
|
||||
float3 CamRelPos : TEXCOORD8;
|
||||
};
|
||||
|
||||
struct PS_OUTPUT
|
||||
{
|
||||
float4 Diffuse : SV_Target0;
|
||||
float4 Normal : SV_Target1;
|
||||
float4 Specular : SV_Target2;
|
||||
float4 Irradiance : SV_Target3;
|
||||
};
|
||||
|
||||
|
||||
@@ -0,0 +1,227 @@
|
||||
#include "TerrainPS.hlsli"
|
||||
|
||||
|
||||
PS_OUTPUT main(VS_OUTPUT input)
|
||||
{
|
||||
float4 vc0 = input.Colour0;
|
||||
float4 vc1 = input.Colour1;
|
||||
float2 tc0 = input.Texcoord0;
|
||||
float2 tc1 = input.Texcoord1;
|
||||
float2 tc2 = input.Texcoord2;
|
||||
|
||||
float2 sc0 = tc0;
|
||||
float2 sc1 = tc0;
|
||||
float2 sc2 = tc0;
|
||||
float2 sc3 = tc0;
|
||||
float2 sc4 = tc0;
|
||||
float2 scm = tc1;
|
||||
|
||||
////switch (ShaderName)
|
||||
////{
|
||||
//// case 3965214311: //terrain_cb_w_4lyr_cm_pxm_tnt vt: PNCTTTX_3 //vb_35_beache
|
||||
//// case 4186046662: //terrain_cb_w_4lyr_cm_pxm vt: PNCTTTX_3 //cs6_08_struct08
|
||||
//// //vc1 = vc0;
|
||||
//// //sc1 = tc0*25;
|
||||
//// //sc2 = sc1;
|
||||
//// //sc3 = sc1;
|
||||
//// //sc4 = sc1;
|
||||
//// //scm = tc0;
|
||||
//// break;
|
||||
////}
|
||||
|
||||
float4 bc0 = float4(0.5, 0.5, 0.5, 1);
|
||||
//if (EnableVertexColour)
|
||||
//{
|
||||
// bc0 = vc0;
|
||||
//}
|
||||
|
||||
if (RenderMode == 8) //direct texture - choose texcoords
|
||||
{
|
||||
if (RenderSamplerCoord == 2) sc0 = tc1;
|
||||
else if (RenderSamplerCoord == 3) sc0 = tc2;
|
||||
}
|
||||
|
||||
|
||||
float4 c0 = (EnableTexture0 == 1) ? Colourmap0.Sample(TextureSS, sc0) : bc0;
|
||||
float4 c1 = (EnableTexture1 == 1) ? Colourmap1.Sample(TextureSS, sc1) : bc0;
|
||||
float4 c2 = (EnableTexture2 == 1) ? Colourmap2.Sample(TextureSS, sc2) : bc0;
|
||||
float4 c3 = (EnableTexture3 == 1) ? Colourmap3.Sample(TextureSS, sc3) : bc0;
|
||||
float4 c4 = (EnableTexture4 == 1) ? Colourmap4.Sample(TextureSS, sc4) : bc0;
|
||||
float4 m = (EnableTextureMask == 1) ? Colourmask.Sample(TextureSS, scm) : vc1;
|
||||
float4 b0 = (EnableNormalMap == 1) ? Normalmap0.Sample(TextureSS, sc0) : float4(0.5, 0.5, 0.5, 1);// float4(input.Normal, 0);
|
||||
float4 b1 = (EnableNormalMap == 1) ? Normalmap1.Sample(TextureSS, sc1) : b0;
|
||||
float4 b2 = (EnableNormalMap == 1) ? Normalmap2.Sample(TextureSS, sc2) : b0;
|
||||
float4 b3 = (EnableNormalMap == 1) ? Normalmap3.Sample(TextureSS, sc3) : b0;
|
||||
float4 b4 = (EnableNormalMap == 1) ? Normalmap4.Sample(TextureSS, sc4) : b0;
|
||||
|
||||
float4 tv=0, nv=0;
|
||||
float4 t1, t2, n1, n2;
|
||||
|
||||
switch (ShaderName)
|
||||
{
|
||||
case 137526804: //terrain_cb_w_4lyr_lod vt: PNCCT //brdgeplatform_01_lod..
|
||||
//return float4(vc1.rgb, vc1.a*0.5 + 0.5);
|
||||
t1 = c1*(1 - vc1.b) + c2*vc1.b;
|
||||
t2 = c3*(1 - vc1.b) + c4*vc1.b;
|
||||
tv = t1*(1 - vc1.g) + t2*vc1.g;
|
||||
n1 = b1*(1 - vc1.b) + b2*vc1.b;
|
||||
n2 = b3*(1 - vc1.b) + b4*vc1.b;
|
||||
nv = n1*(1 - vc1.g) + n2*vc1.g;
|
||||
break;
|
||||
|
||||
default:
|
||||
case 2535953532: //terrain_cb_w_4lyr_2tex_blend_lod vt: PNCCTT //cs1_12_riverbed1_lod..
|
||||
//return float4(vc0.rgb, vc0.a*0.5 + 0.5);
|
||||
//return float4(vc1.rgb, vc1.a*0.5 + 0.5);
|
||||
vc1 = m*(1 - vc0.a) + vc1*vc0.a;
|
||||
t1 = c1*(1 - vc1.b) + c2*vc1.b;
|
||||
t2 = c3*(1 - vc1.b) + c4*vc1.b;
|
||||
tv = t1*(1 - vc1.g) + t2*vc1.g;
|
||||
n1 = b1*(1 - vc1.b) + b2*vc1.b;
|
||||
n2 = b3*(1 - vc1.b) + b4*vc1.b;
|
||||
nv = n1*(1 - vc1.g) + n2*vc1.g;
|
||||
break;
|
||||
|
||||
|
||||
case 653544224: //terrain_cb_w_4lyr_2tex_blend_pxm_spm vt: PNCCTTTX //ch2_04_land06, rd_04_20..
|
||||
case 2486206885: //terrain_cb_w_4lyr_2tex_blend_pxm vt: PNCCTTTX //cs2_06c_lkbed_05..
|
||||
case 1888432890: //terrain_cb_w_4lyr_2tex_pxm vt: PNCCTTTX //ch1_04b_vineland01..
|
||||
//return float4(0, 1, 0, 1);
|
||||
vc1 = m*(1 - vc0.a) + vc1*vc0.a; //perhaps another sampling of the mask is needed here
|
||||
t1 = c1*(1 - vc1.b) + c2*vc1.b;
|
||||
t2 = c3*(1 - vc1.b) + c4*vc1.b;
|
||||
tv = t1*(1 - vc1.g) + t2*vc1.g;
|
||||
n1 = b1*(1 - vc1.b) + b2*vc1.b;
|
||||
n2 = b3*(1 - vc1.b) + b4*vc1.b;
|
||||
nv = n1*(1 - vc1.g) + n2*vc1.g;
|
||||
break;
|
||||
|
||||
|
||||
case 3051127652: //terrain_cb_w_4lyr vt: PNCCTX //ss1_05_gr..
|
||||
case 646532852: //terrain_cb_w_4lyr_spec vt: PNCCTX //hw1_07_grnd_c..
|
||||
//return float4(1, 1, 0, 1);
|
||||
vc1 = m*(1 - vc0.a) + vc1*vc0.a; //perhaps another sampling of the mask is needed here
|
||||
t1 = c1*(1 - vc1.b) + c2*vc1.b;
|
||||
t2 = c3*(1 - vc1.b) + c4*vc1.b;
|
||||
tv = t1*(1 - vc1.g) + t2*vc1.g;
|
||||
n1 = b1*(1 - vc1.b) + b2*vc1.b;
|
||||
n2 = b3*(1 - vc1.b) + b4*vc1.b;
|
||||
nv = n1*(1 - vc1.g) + n2*vc1.g;
|
||||
break;
|
||||
|
||||
|
||||
case 2316006813: //terrain_cb_w_4lyr_2tex_blend vt: PNCCTTX //ch2_04_land02b, vb_34_beachn_01..
|
||||
case 3112820305: //terrain_cb_w_4lyr_2tex vt: PNCCTTX //ch1_05_land5..
|
||||
case 2601000386: //terrain_cb_w_4lyr_spec_pxm vt: PNCCTTX_2 //ch2_03_land05, grnd_low2.. _road
|
||||
case 4105814572: //terrain_cb_w_4lyr_pxm vt: PNCCTTX_2 //ch2_06_house02.. vb_35_beache
|
||||
case 3400824277: //terrain_cb_w_4lyr_pxm_spm vt: PNCCTTX_2 //ch2_04_land02b, ch2_06_terrain01a .. vb_35_beacha
|
||||
//return float4(1, 1, 1, 1);
|
||||
vc1 = m*(1 - vc0.a) + vc1*vc0.a; //perhaps another sampling of the mask is needed here
|
||||
t1 = c1*(1 - vc1.b) + c2*vc1.b;
|
||||
t2 = c3*(1 - vc1.b) + c4*vc1.b;
|
||||
tv = t1*(1 - vc1.g) + t2*vc1.g;
|
||||
n1 = b1*(1 - vc1.b) + b2*vc1.b;
|
||||
n2 = b3*(1 - vc1.b) + b4*vc1.b;
|
||||
nv = n1*(1 - vc1.g) + n2*vc1.g;
|
||||
break;
|
||||
|
||||
|
||||
case 295525123: //terrain_cb_w_4lyr_cm vt: PNCTTX //_prewtrproxy_2..
|
||||
case 417637541: //terrain_cb_w_4lyr_cm_tnt vt: PNCTTX //_prewtrproxy_2.. //golf course..
|
||||
//tv = 1;// c1;// *vc0.r; //TODO!
|
||||
//nv = b0;
|
||||
vc1 = m; //needs work!
|
||||
t1 = c1*(1 - vc1.b) + c2*vc1.b;
|
||||
t2 = c3*(1 - vc1.b) + c4*vc1.b;
|
||||
tv = t1*(1 - vc1.g) + t2*vc1.g;
|
||||
n1 = b1*(1 - vc1.b) + b2*vc1.b;
|
||||
n2 = b3*(1 - vc1.b) + b4*vc1.b;
|
||||
nv = n1*(1 - vc1.g) + n2*vc1.g;
|
||||
break;
|
||||
|
||||
case 3965214311: //terrain_cb_w_4lyr_cm_pxm_tnt vt: PNCTTTX_3 //vb_35_beache
|
||||
case 4186046662: //terrain_cb_w_4lyr_cm_pxm vt: PNCTTTX_3 //cs6_08_struct08
|
||||
//m = min(m, vc0);
|
||||
//return float4(m.rgb, m.a*0.5 + 0.5);
|
||||
//return float4(vc0.rgb, vc0.a*0.5 + 0.5);
|
||||
//return float4(0, 1, 1, 1);
|
||||
//m = vc0;
|
||||
vc1 = m; //needs work!
|
||||
t1 = c1*(1 - vc1.b) + c2*vc1.b;
|
||||
t2 = c3*(1 - vc1.b) + c4*vc1.b;
|
||||
tv = t1*(1 - vc1.g) + t2*vc1.g;
|
||||
n1 = b1*(1 - vc1.b) + b2*vc1.b;
|
||||
n2 = b3*(1 - vc1.b) + b4*vc1.b;
|
||||
nv = n1*(1 - vc1.g) + n2*vc1.g;
|
||||
break;
|
||||
|
||||
}
|
||||
if (EnableTint == 1)
|
||||
{
|
||||
tv.rgb *= input.Tint.rgb;
|
||||
}
|
||||
|
||||
|
||||
if (RenderMode == 1) //normals
|
||||
{
|
||||
tv.rgb = normalize(input.Normal)*0.5+0.5;
|
||||
}
|
||||
else if (RenderMode == 2) //tangents
|
||||
{
|
||||
tv.rgb = normalize(input.Tangent.xyz)*0.5+0.5;
|
||||
}
|
||||
else if (RenderMode == 3) //colours
|
||||
{
|
||||
tv.rgb = input.Colour0.rgb;
|
||||
if (RenderModeIndex == 2) tv.rgb = input.Colour1.rgb;
|
||||
}
|
||||
else if (RenderMode == 4) //texcoords
|
||||
{
|
||||
tv.rgb = float3(input.Texcoord0, 0);
|
||||
if (RenderModeIndex == 2) tv.rgb = float3(input.Texcoord1, 0);
|
||||
if (RenderModeIndex == 3) tv.rgb = float3(input.Texcoord2, 0);
|
||||
}
|
||||
else if (RenderMode == 5) //render diffuse maps
|
||||
{
|
||||
//nothing to do here yet, diffuse maps rendered by default
|
||||
}
|
||||
else if (RenderMode == 6) //render normalmaps
|
||||
{
|
||||
tv.rgb = nv.rgb;
|
||||
}
|
||||
else if (RenderMode == 7) //render spec maps
|
||||
{
|
||||
tv.rgb = 0.5; //nothing to see here yet...
|
||||
}
|
||||
else if (RenderMode == 8) //render direct texture
|
||||
{
|
||||
tv = c0;
|
||||
}
|
||||
|
||||
//nv = normalize(nv*2-1);
|
||||
//float4 tang = input.Tangent;
|
||||
float3 nz = normalize(input.Normal);
|
||||
//float3 nx = normalize(tang.xyz);
|
||||
//float3 ny = normalize(cross(nz, nx));
|
||||
////float3 norm = normalize(nx*nv.x + ny*nv.y + nz*nv.z);
|
||||
float3 norm = nz;// normalize(input.Normal)
|
||||
|
||||
|
||||
if ((RenderMode == 0) && (EnableNormalMap == 1))
|
||||
{
|
||||
norm = NormalMap(nv.xy, bumpiness, input.Normal.xyz, input.Tangent.xyz, input.Bitangent.xyz);
|
||||
}
|
||||
|
||||
float3 spec = float3(0, 0, 1);
|
||||
|
||||
tv.a = saturate(tv.a);
|
||||
|
||||
|
||||
PS_OUTPUT output;
|
||||
output.Diffuse = tv;
|
||||
output.Normal = float4(saturate(norm * 0.5 + 0.5), tv.a);
|
||||
output.Specular = float4(spec, tv.a);
|
||||
output.Irradiance = float4(input.Colour0.rg, 0, tv.a);
|
||||
|
||||
return output;
|
||||
}
|
||||
@@ -1,30 +1,4 @@
|
||||
#include "Common.hlsli"
|
||||
|
||||
Texture2D<float4> Colourmap : register(t0);
|
||||
SamplerState TextureSS : register(s0);
|
||||
|
||||
|
||||
cbuffer PSSceneVars : register(b0)
|
||||
{
|
||||
ShaderGlobalLightParams GlobalLights;
|
||||
}
|
||||
cbuffer PSEntityVars : register(b1)
|
||||
{
|
||||
uint EnableTexture;
|
||||
uint Pad1;
|
||||
uint Pad2;
|
||||
uint Pad3;
|
||||
}
|
||||
|
||||
|
||||
struct VS_OUTPUT
|
||||
{
|
||||
float4 Position : SV_POSITION;
|
||||
float3 Normal : NORMAL;
|
||||
float2 Texcoord : TEXCOORD0;
|
||||
float4 Colour : COLOR0;
|
||||
};
|
||||
|
||||
#include "TreesLodPS.hlsli"
|
||||
|
||||
|
||||
float4 main(VS_OUTPUT input) : SV_TARGET
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
#include "Common.hlsli"
|
||||
|
||||
Texture2D<float4> Colourmap : register(t0);
|
||||
SamplerState TextureSS : register(s0);
|
||||
|
||||
|
||||
cbuffer PSSceneVars : register(b0)
|
||||
{
|
||||
ShaderGlobalLightParams GlobalLights;
|
||||
}
|
||||
cbuffer PSEntityVars : register(b1)
|
||||
{
|
||||
uint EnableTexture;
|
||||
uint Pad1;
|
||||
uint Pad2;
|
||||
uint Pad3;
|
||||
}
|
||||
|
||||
|
||||
struct VS_OUTPUT
|
||||
{
|
||||
float4 Position : SV_POSITION;
|
||||
float3 Normal : NORMAL;
|
||||
float2 Texcoord : TEXCOORD0;
|
||||
float4 Colour : COLOR0;
|
||||
};
|
||||
|
||||
struct PS_OUTPUT
|
||||
{
|
||||
float4 Diffuse : SV_Target0;
|
||||
float4 Normal : SV_Target1;
|
||||
float4 Specular : SV_Target2;
|
||||
float4 Irradiance : SV_Target3;
|
||||
};
|
||||
|
||||
@@ -0,0 +1,35 @@
|
||||
#include "TreesLodPS.hlsli"
|
||||
|
||||
|
||||
PS_OUTPUT main(VS_OUTPUT input)
|
||||
{
|
||||
//return float4(1,0,0,1);//red
|
||||
|
||||
float4 c = 0; // float4(input.Colour.rgb, 1);
|
||||
//return c;
|
||||
|
||||
if (EnableTexture == 1)
|
||||
{
|
||||
//c = Colourmap.SampleLevel(TextureSS, input.Texcoord, 0);
|
||||
c = Colourmap.Sample(TextureSS, input.Texcoord);
|
||||
if (c.a <= 0.25) discard;
|
||||
c.a = 1;
|
||||
// c = float4(input.Colour.rgb, 1);
|
||||
}
|
||||
|
||||
float3 norm = input.Normal;
|
||||
|
||||
|
||||
float3 spec = 0;
|
||||
|
||||
c.a = saturate(c.a);
|
||||
|
||||
PS_OUTPUT output;
|
||||
output.Diffuse = c;
|
||||
output.Normal = float4(saturate(norm * 0.5 + 0.5), c.a);
|
||||
output.Specular = float4(spec, c.a);
|
||||
output.Irradiance = float4(1, 0, 0, c.a);
|
||||
|
||||
return output;
|
||||
|
||||
}
|
||||
@@ -1,128 +1,4 @@
|
||||
#include "Shadowmap.hlsli"
|
||||
|
||||
Texture2D<float4> Colourmap : register(t0);
|
||||
Texture2D<float4> Bumpmap : register(t2);
|
||||
Texture2D<float4> Foammap : register(t3);
|
||||
Texture2D<float4> WaterBumpSampler : register(t4);// graphics.ytd, waterbump and waterbump2
|
||||
Texture2D<float4> WaterBumpSampler2 : register(t5);
|
||||
Texture2D<float4> WaterFog : register(t6);
|
||||
SamplerState TextureSS : register(s0);
|
||||
|
||||
|
||||
cbuffer PSSceneVars : register(b0)
|
||||
{
|
||||
ShaderGlobalLightParams GlobalLights;
|
||||
uint EnableShadows;
|
||||
uint RenderMode;//0=default, 1=normals, 2=tangents, 3=colours, 4=texcoords, 5=diffuse, 6=normalmap, 7=spec, 8=direct
|
||||
uint RenderModeIndex;
|
||||
uint RenderSamplerCoord;
|
||||
uint EnableWaterbumps;//if the waterbump textures are ready..
|
||||
uint EnableFogtex; //if the fog texture is ready
|
||||
uint ScnPad1;
|
||||
uint ScnPad2;
|
||||
float4 gFlowParams;
|
||||
float4 CameraPos;
|
||||
float4 WaterFogParams; //xy = base location, zw = inverse size
|
||||
}
|
||||
cbuffer PSGeomVars : register(b2)
|
||||
{
|
||||
uint EnableTexture;
|
||||
uint EnableBumpMap;
|
||||
uint EnableFoamMap;
|
||||
uint ShaderMode;
|
||||
float SpecularIntensity;
|
||||
float SpecularFalloff;
|
||||
float GeoPad1;
|
||||
float GeoPad2;
|
||||
float WaveOffset; //for terrainfoam
|
||||
float WaterHeight; //for terrainfoam
|
||||
float WaveMovement; //for terrainfoam
|
||||
float HeightOpacity; //for terrainfoam
|
||||
float RippleSpeed;
|
||||
float RippleScale;
|
||||
float RippleBumpiness;
|
||||
float GeoPad3;
|
||||
}
|
||||
|
||||
|
||||
struct VS_OUTPUT
|
||||
{
|
||||
float4 Position : SV_POSITION;
|
||||
float3 Normal : NORMAL;
|
||||
float2 Texcoord0 : TEXCOORD0;
|
||||
float4 Flow : TEXCOORD1;
|
||||
float4 Shadows : TEXCOORD3;
|
||||
float4 LightShadow : TEXCOORD4;
|
||||
float4 Colour0 : COLOR0;
|
||||
float4 Tangent : TEXCOORD5;
|
||||
float4 Bitangent : TEXCOORD6;
|
||||
float3 CamRelPos : TEXCOORD7;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
float3 RippleNormal(VS_OUTPUT input, float3 worldpos)
|
||||
{
|
||||
////
|
||||
//// Input signature:
|
||||
////
|
||||
//// Name Index Mask Register SysValue Format Used
|
||||
//// -------------------- ----- ------ -------- -------- ------- ------
|
||||
//// SV_Position 0 xyzw 0 POS float
|
||||
//// TEXCOORD 0 xyzw 1 NONE float xyzw
|
||||
//// TEXCOORD 1 xyzw 2 NONE float xyzw
|
||||
//// TEXCOORD 2 xyzw 3 NONE float zw
|
||||
//// TEXCOORD 3 xyzw 4 NONE float xyzw //NORMAL +half
|
||||
//// TEXCOORD 4 xyzw 5 NONE float zw //FLOW
|
||||
////
|
||||
//
|
||||
|
||||
float3 norm = input.Normal.xyz;
|
||||
float v2w = input.Colour0.r; //vertex red channel
|
||||
|
||||
float4 r0, r1, r2, r3, r4;
|
||||
|
||||
r0.xy = input.Flow.zw * RippleSpeed; //mul r0.xy, v5.zwzz, RippleSpeed
|
||||
r1 = -r0.xyxy * gFlowParams.xxyy + worldpos.xyxy; //mad r1.xyzw, -r0.xyxy, gFlowParams.xxyy, v2.xyxy
|
||||
r0.x = min(sqrt(dot(r0.xy, r0.xy)), 1.0); //dp2 r0.x, r0.xyxx, r0.xyxx //sqrt r0.x, r0.x //min r0.x, r0.x, l(1.000000)
|
||||
r0.yz = r1.xy * RippleScale; //mul r0.yz, r1.xxyx, RippleScale
|
||||
r1.xy = r1.zw * RippleScale + 0.5; //mad r1.xy, r1.zwzz, RippleScale, l(0.500000, 0.500000, 0.000000, 0.000000)
|
||||
r1.xy = r1.xy * 2.3; //mul r1.xy, r1.xyxx, l(2.300000, 2.300000, 0.000000, 0.000000)
|
||||
r0.yz = r0.yz * 2.3; //mul r0.yz, r0.yyzy, l(0.000000, 2.300000, 2.300000, 0.000000)
|
||||
r2 = WaterBumpSampler2.Sample(TextureSS, r0.yz); //sample r2.xyzw, r0.yzyy, WaterBumpSampler2.xyzw, s14
|
||||
r3 = WaterBumpSampler.Sample(TextureSS, r0.yz); //sample r3.xyzw, r0.yzyy, WaterBumpSampler.xyzw, s10
|
||||
r4 = WaterBumpSampler2.Sample(TextureSS, r1.xy); //sample r4.xyzw, r1.xyxx, WaterBumpSampler2.xyzw, s14
|
||||
r1 = WaterBumpSampler.Sample(TextureSS, r1.xy); //sample r1.xyzw, r1.xyxx, WaterBumpSampler.xyzw, s10
|
||||
r3.zw = r1.xy; //mov r3.zw, r1.xxxy
|
||||
r2.zw = r4.xy; //mov r2.zw, r4.xxxy
|
||||
r1 = r2 + r3; //add r1.xyzw, r2.xyzw, r3.xyzw
|
||||
r2 = r3 + 0.5; //add r2.xyzw, r3.xyzw, l(0.500000, 0.500000, 0.500000, 0.500000)
|
||||
r1 = r1 - r2; //add r1.xyzw, r1.xyzw, -r2.xyzw
|
||||
r0 = r1 * r0.x + r2; //mad r0.xyzw, r0.xxxx, r1.xyzw, r2.xyzw
|
||||
r0 = r0 * 2 - 2; //mad r0.xyzw, r0.xyzw, l(2.000000, 2.000000, 2.000000, 2.000000), l(-2.000000, -2.000000, -2.000000, -2.000000)
|
||||
r0 = r0 * gFlowParams.zzww; //mul r0.xyzw, r0.xyzw, gFlowParams.zzww
|
||||
r0.xy = r0.xy + r0.zw; //add r0.xy, r0.zwzz, r0.xyxx
|
||||
r0.zw = r0.xy * RippleBumpiness;//mul r0.zw, r0.xxxy, RippleBumpiness
|
||||
//r0.x = sqrt(dot(r0.xy, r0.xy)); //dp2 r0.x, r0.xyxx, r0.xyxx //sqrt r0.x, r0.x
|
||||
//r0.x = r0.x * 0.27 + 0.44; //mad r0.x, r0.x, l(0.270000), l(0.440000)
|
||||
r1.xy = r0.zw * v2w + norm.xy; //mad r1.xy, r0.zwzz, v2.wwww, v4.xyxx
|
||||
r1.z = norm.z; //mov r1.z, v4.z
|
||||
//return normalize(r1.xyz);
|
||||
r0.y = dot(r1.xyz, r1.xyz); //dp3 r0.y, r1.xyzx, r1.xyzx
|
||||
r0.y = 1.0 / sqrt(r0.y); //rsq r0.y, r0.y
|
||||
r2.xyz = -r1.xyz * r0.y + float3(0, 0, 1); //mad r2.xyz, -r1.xyzx, r0.yyyy, l(0.000000, 0.000000, 1.000000, 0.000000)
|
||||
r0.yzw = r1.xyz * r0.y; //mul r0.yzw, r0.yyyy, r1.xxyz
|
||||
//r1.xyz = r2.xyz * 0.833333 + r0.yzw; //mad r1.xyz, r2.xyzx, l(0.833333, 0.833333, 0.833333, 0.000000), r0.yzwy
|
||||
//r2.xyz = worldpos - //add r2.xyz, v2.xyzx, -gViewInverse[3].xyzx
|
||||
|
||||
return r0.yzw;
|
||||
//return r0.wzy;
|
||||
////return float3(r0.w, r0.z, r0.y);
|
||||
|
||||
////return normalize(input.Normal);
|
||||
}
|
||||
|
||||
#include "WaterPS.hlsli"
|
||||
|
||||
|
||||
float4 main(VS_OUTPUT input) : SV_TARGET
|
||||
|
||||
@@ -0,0 +1,133 @@
|
||||
#include "Shadowmap.hlsli"
|
||||
|
||||
Texture2D<float4> Colourmap : register(t0);
|
||||
Texture2D<float4> Bumpmap : register(t2);
|
||||
Texture2D<float4> Foammap : register(t3);
|
||||
Texture2D<float4> WaterBumpSampler : register(t4); // graphics.ytd, waterbump and waterbump2
|
||||
Texture2D<float4> WaterBumpSampler2 : register(t5);
|
||||
Texture2D<float4> WaterFog : register(t6);
|
||||
SamplerState TextureSS : register(s0);
|
||||
|
||||
|
||||
cbuffer PSSceneVars : register(b0)
|
||||
{
|
||||
ShaderGlobalLightParams GlobalLights;
|
||||
uint EnableShadows;
|
||||
uint RenderMode; //0=default, 1=normals, 2=tangents, 3=colours, 4=texcoords, 5=diffuse, 6=normalmap, 7=spec, 8=direct
|
||||
uint RenderModeIndex;
|
||||
uint RenderSamplerCoord;
|
||||
uint EnableWaterbumps; //if the waterbump textures are ready..
|
||||
uint EnableFogtex; //if the fog texture is ready
|
||||
uint ScnPad1;
|
||||
uint ScnPad2;
|
||||
float4 gFlowParams;
|
||||
float4 CameraPos;
|
||||
float4 WaterFogParams; //xy = base location, zw = inverse size
|
||||
}
|
||||
cbuffer PSGeomVars : register(b2)
|
||||
{
|
||||
uint EnableTexture;
|
||||
uint EnableBumpMap;
|
||||
uint EnableFoamMap;
|
||||
uint ShaderMode;
|
||||
float SpecularIntensity;
|
||||
float SpecularFalloff;
|
||||
float GeoPad1;
|
||||
float GeoPad2;
|
||||
float WaveOffset; //for terrainfoam
|
||||
float WaterHeight; //for terrainfoam
|
||||
float WaveMovement; //for terrainfoam
|
||||
float HeightOpacity; //for terrainfoam
|
||||
float RippleSpeed;
|
||||
float RippleScale;
|
||||
float RippleBumpiness;
|
||||
float GeoPad3;
|
||||
}
|
||||
|
||||
|
||||
struct VS_OUTPUT
|
||||
{
|
||||
float4 Position : SV_POSITION;
|
||||
float3 Normal : NORMAL;
|
||||
float2 Texcoord0 : TEXCOORD0;
|
||||
float4 Flow : TEXCOORD1;
|
||||
float4 Shadows : TEXCOORD3;
|
||||
float4 LightShadow : TEXCOORD4;
|
||||
float4 Colour0 : COLOR0;
|
||||
float4 Tangent : TEXCOORD5;
|
||||
float4 Bitangent : TEXCOORD6;
|
||||
float3 CamRelPos : TEXCOORD7;
|
||||
};
|
||||
|
||||
struct PS_OUTPUT
|
||||
{
|
||||
float4 Diffuse : SV_Target0;
|
||||
float4 Normal : SV_Target1;
|
||||
float4 Specular : SV_Target2;
|
||||
float4 Irradiance : SV_Target3;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
float3 RippleNormal(VS_OUTPUT input, float3 worldpos)
|
||||
{
|
||||
////
|
||||
//// Input signature:
|
||||
////
|
||||
//// Name Index Mask Register SysValue Format Used
|
||||
//// -------------------- ----- ------ -------- -------- ------- ------
|
||||
//// SV_Position 0 xyzw 0 POS float
|
||||
//// TEXCOORD 0 xyzw 1 NONE float xyzw
|
||||
//// TEXCOORD 1 xyzw 2 NONE float xyzw
|
||||
//// TEXCOORD 2 xyzw 3 NONE float zw
|
||||
//// TEXCOORD 3 xyzw 4 NONE float xyzw //NORMAL +half
|
||||
//// TEXCOORD 4 xyzw 5 NONE float zw //FLOW
|
||||
////
|
||||
//
|
||||
|
||||
float3 norm = input.Normal.xyz;
|
||||
float v2w = input.Colour0.r; //vertex red channel
|
||||
|
||||
float4 r0, r1, r2, r3, r4;
|
||||
|
||||
r0.xy = input.Flow.zw * RippleSpeed; //mul r0.xy, v5.zwzz, RippleSpeed
|
||||
r1 = -r0.xyxy * gFlowParams.xxyy + worldpos.xyxy; //mad r1.xyzw, -r0.xyxy, gFlowParams.xxyy, v2.xyxy
|
||||
r0.x = min(sqrt(dot(r0.xy, r0.xy)), 1.0); //dp2 r0.x, r0.xyxx, r0.xyxx //sqrt r0.x, r0.x //min r0.x, r0.x, l(1.000000)
|
||||
r0.yz = r1.xy * RippleScale; //mul r0.yz, r1.xxyx, RippleScale
|
||||
r1.xy = r1.zw * RippleScale + 0.5; //mad r1.xy, r1.zwzz, RippleScale, l(0.500000, 0.500000, 0.000000, 0.000000)
|
||||
r1.xy = r1.xy * 2.3; //mul r1.xy, r1.xyxx, l(2.300000, 2.300000, 0.000000, 0.000000)
|
||||
r0.yz = r0.yz * 2.3; //mul r0.yz, r0.yyzy, l(0.000000, 2.300000, 2.300000, 0.000000)
|
||||
r2 = WaterBumpSampler2.Sample(TextureSS, r0.yz); //sample r2.xyzw, r0.yzyy, WaterBumpSampler2.xyzw, s14
|
||||
r3 = WaterBumpSampler.Sample(TextureSS, r0.yz); //sample r3.xyzw, r0.yzyy, WaterBumpSampler.xyzw, s10
|
||||
r4 = WaterBumpSampler2.Sample(TextureSS, r1.xy); //sample r4.xyzw, r1.xyxx, WaterBumpSampler2.xyzw, s14
|
||||
r1 = WaterBumpSampler.Sample(TextureSS, r1.xy); //sample r1.xyzw, r1.xyxx, WaterBumpSampler.xyzw, s10
|
||||
r3.zw = r1.xy; //mov r3.zw, r1.xxxy
|
||||
r2.zw = r4.xy; //mov r2.zw, r4.xxxy
|
||||
r1 = r2 + r3; //add r1.xyzw, r2.xyzw, r3.xyzw
|
||||
r2 = r3 + 0.5; //add r2.xyzw, r3.xyzw, l(0.500000, 0.500000, 0.500000, 0.500000)
|
||||
r1 = r1 - r2; //add r1.xyzw, r1.xyzw, -r2.xyzw
|
||||
r0 = r1 * r0.x + r2; //mad r0.xyzw, r0.xxxx, r1.xyzw, r2.xyzw
|
||||
r0 = r0 * 2 - 2; //mad r0.xyzw, r0.xyzw, l(2.000000, 2.000000, 2.000000, 2.000000), l(-2.000000, -2.000000, -2.000000, -2.000000)
|
||||
r0 = r0 * gFlowParams.zzww; //mul r0.xyzw, r0.xyzw, gFlowParams.zzww
|
||||
r0.xy = r0.xy + r0.zw; //add r0.xy, r0.zwzz, r0.xyxx
|
||||
r0.zw = r0.xy * RippleBumpiness; //mul r0.zw, r0.xxxy, RippleBumpiness
|
||||
//r0.x = sqrt(dot(r0.xy, r0.xy)); //dp2 r0.x, r0.xyxx, r0.xyxx //sqrt r0.x, r0.x
|
||||
//r0.x = r0.x * 0.27 + 0.44; //mad r0.x, r0.x, l(0.270000), l(0.440000)
|
||||
r1.xy = r0.zw * v2w + norm.xy; //mad r1.xy, r0.zwzz, v2.wwww, v4.xyxx
|
||||
r1.z = norm.z; //mov r1.z, v4.z
|
||||
//return normalize(r1.xyz);
|
||||
r0.y = dot(r1.xyz, r1.xyz); //dp3 r0.y, r1.xyzx, r1.xyzx
|
||||
r0.y = 1.0 / sqrt(r0.y); //rsq r0.y, r0.y
|
||||
r2.xyz = -r1.xyz * r0.y + float3(0, 0, 1); //mad r2.xyz, -r1.xyzx, r0.yyyy, l(0.000000, 0.000000, 1.000000, 0.000000)
|
||||
r0.yzw = r1.xyz * r0.y; //mul r0.yzw, r0.yyyy, r1.xxyz
|
||||
//r1.xyz = r2.xyz * 0.833333 + r0.yzw; //mad r1.xyz, r2.xyzx, l(0.833333, 0.833333, 0.833333, 0.000000), r0.yzwy
|
||||
//r2.xyz = worldpos - //add r2.xyz, v2.xyzx, -gViewInverse[3].xyzx
|
||||
|
||||
return r0.yzw;
|
||||
//return r0.wzy;
|
||||
////return float3(r0.w, r0.z, r0.y);
|
||||
|
||||
////return normalize(input.Normal);
|
||||
}
|
||||
@@ -0,0 +1,105 @@
|
||||
#include "WaterPS.hlsli"
|
||||
|
||||
|
||||
PS_OUTPUT main(VS_OUTPUT input)
|
||||
{
|
||||
float4 c = float4(0.1, 0.18, 0.25, 0.8);
|
||||
//if (RenderMode == 0) c = float4(1, 1, 1, 1);
|
||||
|
||||
//c.a *= input.Colour0.a;
|
||||
|
||||
float3 camrel = input.CamRelPos;
|
||||
float3 worldpos = camrel + CameraPos.xyz;
|
||||
if ((EnableFoamMap == 0) && (EnableFogtex == 1))
|
||||
{
|
||||
float2 fogtc = saturate((worldpos.xy - WaterFogParams.xy) * WaterFogParams.zw);
|
||||
fogtc.y = 1.0 - fogtc.y;
|
||||
c = WaterFog.Sample(TextureSS, fogtc);
|
||||
c.a = 0.9;
|
||||
}
|
||||
|
||||
|
||||
float3 norm = EnableFoamMap ? normalize(input.Normal) : RippleNormal(input, worldpos); // normalize(input.Normal);
|
||||
|
||||
if (RenderMode == 1) //normals
|
||||
{
|
||||
c.rgb = norm * 0.5 + 0.5;
|
||||
}
|
||||
else if (RenderMode == 2) //tangents
|
||||
{
|
||||
c.rgb = normalize(input.Tangent.rgb) * 0.5 + 0.5;
|
||||
}
|
||||
else if (RenderMode == 3) //colours
|
||||
{
|
||||
c.rgb = input.Colour0.rgb;
|
||||
}
|
||||
else if (RenderMode == 4) //texcoords
|
||||
{
|
||||
c.rgb = float3(input.Texcoord0, 0);
|
||||
}
|
||||
else if ((RenderMode == 8) || (EnableTexture == 1)) //single texture or diffuse enabled
|
||||
{
|
||||
c.rgb = Colourmap.Sample(TextureSS, input.Texcoord0).rgb;
|
||||
}
|
||||
else if (EnableFoamMap)
|
||||
{
|
||||
c = Foammap.Sample(TextureSS, input.Texcoord0);
|
||||
}
|
||||
|
||||
|
||||
float3 spec = 0;
|
||||
|
||||
if (RenderMode == 0)
|
||||
{
|
||||
|
||||
float4 nv = Bumpmap.Sample(TextureSS, input.Texcoord0); //sample r1.xyzw, v2.xyxx, t3.xyzw, s3 (BumpSampler)
|
||||
|
||||
|
||||
float2 nmv = nv.xy;
|
||||
float4 r0 = 0, r1, r2, r3;
|
||||
|
||||
float bumpiness = 0.5;
|
||||
|
||||
if (EnableBumpMap)
|
||||
{
|
||||
norm = NormalMap(nmv, bumpiness, input.Normal.xyz, input.Tangent.xyz, input.Bitangent.xyz);
|
||||
}
|
||||
|
||||
|
||||
float3 tc = c.rgb;
|
||||
c.rgb = tc; // *r0.z; //diffuse factors...
|
||||
|
||||
|
||||
spec.xy = sqrt(10.0 * SpecularIntensity);
|
||||
spec.z = 1;//r0.z;
|
||||
|
||||
|
||||
|
||||
if (ShaderMode == 1) //river foam
|
||||
{
|
||||
c.a *= input.Colour0.g;
|
||||
}
|
||||
else if (ShaderMode == 2) //terrain foam
|
||||
{
|
||||
c.a *= c.r;
|
||||
c.a *= input.Colour0.r;
|
||||
}
|
||||
else
|
||||
{
|
||||
///c.a = 1;
|
||||
}
|
||||
}
|
||||
|
||||
c.a = saturate(c.a);
|
||||
|
||||
PS_OUTPUT output;
|
||||
output.Diffuse = c;
|
||||
output.Normal = float4(saturate(norm * 0.5 + 0.5), c.a);
|
||||
output.Specular = float4(spec, c.a);
|
||||
output.Irradiance = float4(1, 0, 0, c.a);
|
||||
|
||||
return output;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user