Added vertex shader PNCTT and started implementation of DiffuseSampler2. (#43)

Added vertex shader PNCTT and implementation of DiffuseSampler2.
This commit is contained in:
horstche
2019-02-20 10:41:00 +01:00
committed by dexyfex
Unverified
parent 7fe0bef6bd
commit 3690b082bc
5 changed files with 90 additions and 7 deletions
+11
View File
@@ -4,6 +4,7 @@ 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);
SamplerState TextureSS : register(s0);
@@ -18,6 +19,10 @@ cbuffer PSSceneVars : register(b0)
cbuffer PSGeomVars : register(b2)
{
uint EnableTexture;
uint EnableTexture2;
uint pad1;
uint pad2;
uint pad3;
uint EnableTint;
uint EnableNormalMap;
uint EnableSpecMap;
@@ -74,6 +79,12 @@ float4 main(VS_OUTPUT input) : SV_TARGET
c = Colourmap.Sample(TextureSS, texc);
if (EnableTexture2 == 1)
{
float4 c2 = Colourmap2.Sample(TextureSS, input.Texcoord1);
c = c2.a * c2 + (1 - c2.a) * c;
}
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;
+40
View File
@@ -0,0 +1,40 @@
#include "BasicVS.hlsli"
struct VS_INPUT
{
float4 Position : POSITION;
float3 Normal : NORMAL;
float2 Texcoord0 : TEXCOORD0;
float2 Texcoord1 : TEXCOORD1;
float4 Colour0 : COLOR0;
};
VS_OUTPUT main(VS_INPUT input, uint iid : SV_InstanceID)
{
VS_OUTPUT output;
float3 opos = ModelTransform(input.Position.xyz, input.Colour0.xyz, input.Colour0.xyz, iid);
float4 cpos = ScreenTransform(opos);
float3 bnorm = NormalTransform(input.Normal);
float3 btang = 0.5;// NormalTransform(float3(1, 0, 0)); //no tangent to use on this vertex type...
float4 tnt = ColourTint(input.Colour0.b, 0, iid); //colour tinting if enabled
float4 lightspacepos;
float shadowdepth = ShadowmapSceneDepth(opos, lightspacepos);
output.LightShadow = lightspacepos;
output.Shadows = float4(shadowdepth, 0, 0, 0);
output.Position = cpos;
output.CamRelPos = opos;
output.Normal = bnorm;
output.Texcoord0 = input.Texcoord0;
output.Texcoord1 = input.Texcoord1;
output.Texcoord2 = 0.5;// input.Texcoord;
output.Colour0 = input.Colour0;
output.Colour1 = float4(0.5, 0.5, 0.5, 1); //input.Colour;
output.Tint = tnt;
output.Tangent = float4(btang, 1);
output.Bitangent = float4(cross(btang, bnorm), 0);
return output;
}
+10
View File
@@ -196,6 +196,16 @@
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">4.0</ShaderModel>
<ShaderModel Condition="'$(Configuration)|$(Platform)'=='Release|x64'">4.0</ShaderModel>
</FxCompile>
<FxCompile Include="BasicVS_PNCTT.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="BasicVS_PNCTTTX.hlsl">
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Vertex</ShaderType>
<ShaderType Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Vertex</ShaderType>
@@ -22,6 +22,7 @@
<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" />