Moved shaders to new directory
This commit is contained in:
parent
0b3f8340e3
commit
99b226237a
1244 changed files with 0 additions and 0 deletions
15
shaders/hlsl/indirectdraw/ground.frag
Normal file
15
shaders/hlsl/indirectdraw/ground.frag
Normal file
|
|
@ -0,0 +1,15 @@
|
|||
// Copyright 2020 Google LLC
|
||||
|
||||
Texture2D textureColor : register(t2);
|
||||
SamplerState samplerColor : register(s2);
|
||||
|
||||
struct VSOutput
|
||||
{
|
||||
[[vk::location(0)]] float2 UV : TEXCOORD0;
|
||||
};
|
||||
|
||||
float4 main(VSOutput input) : SV_TARGET
|
||||
{
|
||||
float4 color = textureColor.Sample(samplerColor, input.UV);
|
||||
return float4(color.rgb, 1.0);
|
||||
}
|
||||
BIN
shaders/hlsl/indirectdraw/ground.frag.spv
Normal file
BIN
shaders/hlsl/indirectdraw/ground.frag.spv
Normal file
Binary file not shown.
31
shaders/hlsl/indirectdraw/ground.vert
Normal file
31
shaders/hlsl/indirectdraw/ground.vert
Normal file
|
|
@ -0,0 +1,31 @@
|
|||
// Copyright 2020 Google LLC
|
||||
|
||||
struct VSInput
|
||||
{
|
||||
[[vk::location(0)]] float4 Pos : POSITION0;
|
||||
[[vk::location(1)]] float3 Normal : NORMAL0;
|
||||
[[vk::location(2)]] float2 UV : TEXCOORD0;
|
||||
[[vk::location(3)]] float3 Color : COLOR0;
|
||||
};
|
||||
|
||||
struct UBO
|
||||
{
|
||||
float4x4 projection;
|
||||
float4x4 modelview;
|
||||
};
|
||||
|
||||
cbuffer ubo : register(b0) { UBO ubo; }
|
||||
|
||||
struct VSOutput
|
||||
{
|
||||
float4 Pos : SV_POSITION;
|
||||
[[vk::location(0)]] float2 UV : TEXCOORD0;
|
||||
};
|
||||
|
||||
VSOutput main(VSInput input)
|
||||
{
|
||||
VSOutput output = (VSOutput)0;
|
||||
output.UV = input.UV * 32.0;
|
||||
output.Pos = mul(ubo.projection, mul(ubo.modelview, float4(input.Pos.xyz, 1.0)));
|
||||
return output;
|
||||
}
|
||||
BIN
shaders/hlsl/indirectdraw/ground.vert.spv
Normal file
BIN
shaders/hlsl/indirectdraw/ground.vert.spv
Normal file
Binary file not shown.
29
shaders/hlsl/indirectdraw/indirectdraw.frag
Normal file
29
shaders/hlsl/indirectdraw/indirectdraw.frag
Normal file
|
|
@ -0,0 +1,29 @@
|
|||
// Copyright 2020 Google LLC
|
||||
|
||||
Texture2DArray textureArray : register(t1);
|
||||
SamplerState samplerArray : register(s1);
|
||||
|
||||
struct VSOutput
|
||||
{
|
||||
[[vk::location(0)]] float3 Normal : NORMAL0;
|
||||
[[vk::location(1)]] float3 Color : COLOR0;
|
||||
[[vk::location(2)]] float3 UV : TEXCOORD0;
|
||||
[[vk::location(3)]] float3 ViewVec : TEXCOORD1;
|
||||
[[vk::location(4)]] float3 LightVec : TEXCOORD2;
|
||||
};
|
||||
|
||||
float4 main(VSOutput input) : SV_TARGET
|
||||
{
|
||||
float4 color = textureArray.Sample(samplerArray, input.UV);
|
||||
|
||||
if (color.a < 0.5)
|
||||
{
|
||||
clip(-1);
|
||||
}
|
||||
|
||||
float3 N = normalize(input.Normal);
|
||||
float3 L = normalize(input.LightVec);
|
||||
float3 ambient = float3(0.65, 0.65, 0.65);
|
||||
float3 diffuse = max(dot(N, L), 0.0) * input.Color;
|
||||
return float4((ambient + diffuse) * color.rgb, 1.0);
|
||||
}
|
||||
BIN
shaders/hlsl/indirectdraw/indirectdraw.frag.spv
Normal file
BIN
shaders/hlsl/indirectdraw/indirectdraw.frag.spv
Normal file
Binary file not shown.
81
shaders/hlsl/indirectdraw/indirectdraw.vert
Normal file
81
shaders/hlsl/indirectdraw/indirectdraw.vert
Normal file
|
|
@ -0,0 +1,81 @@
|
|||
// Copyright 2020 Google LLC
|
||||
|
||||
struct VSInput
|
||||
{
|
||||
[[vk::location(0)]] float4 Pos : POSITION0;
|
||||
[[vk::location(1)]] float3 Normal : NORMAL0;
|
||||
[[vk::location(2)]] float2 UV : TEXCOORD0;
|
||||
[[vk::location(3)]] float3 Color : COLOR0;
|
||||
[[vk::location(4)]] float3 instancePos : POSITION1;
|
||||
[[vk::location(5)]] float3 instanceRot : TEXCOORD1;
|
||||
[[vk::location(6)]] float instanceScale : TEXCOORD2;
|
||||
[[vk::location(7)]] int instanceTexIndex : TEXCOORD3;
|
||||
};
|
||||
|
||||
struct UBO
|
||||
{
|
||||
float4x4 projection;
|
||||
float4x4 modelview;
|
||||
};
|
||||
|
||||
cbuffer ubo : register(b0) { UBO ubo; }
|
||||
|
||||
struct VSOutput
|
||||
{
|
||||
float4 Pos : SV_POSITION;
|
||||
[[vk::location(0)]] float3 Normal : NORMAL0;
|
||||
[[vk::location(1)]] float3 Color : COLOR0;
|
||||
[[vk::location(2)]] float3 UV : TEXCOORD0;
|
||||
[[vk::location(3)]] float3 ViewVec : TEXCOORD1;
|
||||
[[vk::location(4)]] float3 LightVec : TEXCOORD2;
|
||||
};
|
||||
|
||||
VSOutput main(VSInput input)
|
||||
{
|
||||
VSOutput output = (VSOutput)0;
|
||||
output.Color = input.Color;
|
||||
output.UV = float3(input.UV, input.instanceTexIndex);
|
||||
|
||||
float4x4 mx, my, mz;
|
||||
|
||||
// rotate around x
|
||||
float s = sin(input.instanceRot.x);
|
||||
float c = cos(input.instanceRot.x);
|
||||
|
||||
mx[0] = float4(c, s, 0.0, 0.0);
|
||||
mx[1] = float4(-s, c, 0.0, 0.0);
|
||||
mx[2] = float4(0.0, 0.0, 1.0, 0.0);
|
||||
mx[3] = float4(0.0, 0.0, 0.0, 1.0);
|
||||
|
||||
// rotate around y
|
||||
s = sin(input.instanceRot.y);
|
||||
c = cos(input.instanceRot.y);
|
||||
|
||||
my[0] = float4(c, 0.0, s, 0.0);
|
||||
my[1] = float4(0.0, 1.0, 0.0, 0.0);
|
||||
my[2] = float4(-s, 0.0, c, 0.0);
|
||||
my[3] = float4(0.0, 0.0, 0.0, 1.0);
|
||||
|
||||
// rot around z
|
||||
s = sin(input.instanceRot.z);
|
||||
c = cos(input.instanceRot.z);
|
||||
|
||||
mz[0] = float4(1.0, 0.0, 0.0, 0.0);
|
||||
mz[1] = float4(0.0, c, s, 0.0);
|
||||
mz[2] = float4(0.0, -s, c, 0.0);
|
||||
mz[3] = float4(0.0, 0.0, 0.0, 1.0);
|
||||
|
||||
float4x4 rotMat = mul(mz, mul(my, mx));
|
||||
|
||||
output.Normal = mul((float4x3)rotMat, input.Normal).xyz;
|
||||
|
||||
float4 pos = mul(rotMat, float4((input.Pos.xyz * input.instanceScale) + input.instancePos, 1.0));
|
||||
|
||||
output.Pos = mul(ubo.projection, mul(ubo.modelview, pos));
|
||||
|
||||
float4 wPos = mul(ubo.modelview, float4(pos.xyz, 1.0));
|
||||
float4 lPos = float4(0.0, -5.0, 0.0, 1.0);
|
||||
output.LightVec = lPos.xyz - pos.xyz;
|
||||
output.ViewVec = -pos.xyz;
|
||||
return output;
|
||||
}
|
||||
BIN
shaders/hlsl/indirectdraw/indirectdraw.vert.spv
Normal file
BIN
shaders/hlsl/indirectdraw/indirectdraw.vert.spv
Normal file
Binary file not shown.
11
shaders/hlsl/indirectdraw/skysphere.frag
Normal file
11
shaders/hlsl/indirectdraw/skysphere.frag
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
// Copyright 2020 Google LLC
|
||||
|
||||
Texture2D textureColor : register(t2);
|
||||
SamplerState samplerColor : register(s2);
|
||||
|
||||
float4 main([[vk::location(0)]] float2 inUV : TEXCOORD0) : SV_TARGET
|
||||
{
|
||||
const float4 gradientStart = float4(0.93, 0.9, 0.81, 1.0);
|
||||
const float4 gradientEnd = float4(0.35, 0.5, 1.0, 1.0);
|
||||
return lerp(gradientStart, gradientEnd, min(0.5 - (inUV.y + 0.05), 0.5)/0.15 + 0.5);
|
||||
}
|
||||
BIN
shaders/hlsl/indirectdraw/skysphere.frag.spv
Normal file
BIN
shaders/hlsl/indirectdraw/skysphere.frag.spv
Normal file
Binary file not shown.
30
shaders/hlsl/indirectdraw/skysphere.vert
Normal file
30
shaders/hlsl/indirectdraw/skysphere.vert
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
// Copyright 2020 Google LLC
|
||||
|
||||
struct VSInput
|
||||
{
|
||||
[[vk::location(0)]] float4 Pos : POSITION0;
|
||||
[[vk::location(2)]] float2 UV : TEXCOORD0;
|
||||
};
|
||||
|
||||
struct UBO
|
||||
{
|
||||
float4x4 projection;
|
||||
float4x4 modelview;
|
||||
};
|
||||
|
||||
cbuffer ubo : register(b0) { UBO ubo; }
|
||||
|
||||
struct VSOutput
|
||||
{
|
||||
float4 Pos : SV_POSITION;
|
||||
[[vk::location(0)]] float2 UV : TEXCOORD0;
|
||||
};
|
||||
|
||||
VSOutput main(VSInput input)
|
||||
{
|
||||
VSOutput output = (VSOutput)0;
|
||||
output.UV = input.UV;
|
||||
// Skysphere always at center, only use rotation part of modelview matrix
|
||||
output.Pos = mul(ubo.projection, float4(mul((float3x3)ubo.modelview, input.Pos.xyz), 1));
|
||||
return output;
|
||||
}
|
||||
BIN
shaders/hlsl/indirectdraw/skysphere.vert.spv
Normal file
BIN
shaders/hlsl/indirectdraw/skysphere.vert.spv
Normal file
Binary file not shown.
Loading…
Add table
Add a link
Reference in a new issue