Add depth-only and shadow-caster pass skeletons
This commit is contained in:
@@ -0,0 +1,7 @@
|
||||
// XC_BUILTIN_DEPTH_ONLY_OPENGL_PS
|
||||
#version 430
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
fragColor = vec4(0.0);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// XC_BUILTIN_DEPTH_ONLY_VULKAN_PS
|
||||
#version 450
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
fragColor = vec4(0.0);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// XC_BUILTIN_DEPTH_ONLY_D3D12_PS
|
||||
struct PSInput {
|
||||
float4 position : SV_POSITION;
|
||||
};
|
||||
|
||||
float4 MainPS(PSInput input) : SV_TARGET {
|
||||
return float4(0.0, 0.0, 0.0, 0.0);
|
||||
}
|
||||
62
engine/assets/builtin/shaders/depth-only/depth-only.shader
Normal file
62
engine/assets/builtin/shaders/depth-only/depth-only.shader
Normal file
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"name": "Builtin Depth Only",
|
||||
"passes": [
|
||||
{
|
||||
"name": "DepthOnly",
|
||||
"tags": {
|
||||
"LightMode": "DepthOnly"
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"name": "PerObjectConstants",
|
||||
"type": "ConstantBuffer",
|
||||
"set": 0,
|
||||
"binding": 0,
|
||||
"semantic": "PerObject"
|
||||
}
|
||||
],
|
||||
"variants": [
|
||||
{
|
||||
"stage": "Vertex",
|
||||
"backend": "D3D12",
|
||||
"language": "HLSL",
|
||||
"source": "depth-only.vs.hlsl",
|
||||
"entryPoint": "MainVS",
|
||||
"profile": "vs_5_0"
|
||||
},
|
||||
{
|
||||
"stage": "Fragment",
|
||||
"backend": "D3D12",
|
||||
"language": "HLSL",
|
||||
"source": "depth-only.ps.hlsl",
|
||||
"entryPoint": "MainPS",
|
||||
"profile": "ps_5_0"
|
||||
},
|
||||
{
|
||||
"stage": "Vertex",
|
||||
"backend": "OpenGL",
|
||||
"language": "GLSL",
|
||||
"source": "depth-only.vert.glsl"
|
||||
},
|
||||
{
|
||||
"stage": "Fragment",
|
||||
"backend": "OpenGL",
|
||||
"language": "GLSL",
|
||||
"source": "depth-only.frag.glsl"
|
||||
},
|
||||
{
|
||||
"stage": "Vertex",
|
||||
"backend": "Vulkan",
|
||||
"language": "GLSL",
|
||||
"source": "depth-only.vert.vk.glsl"
|
||||
},
|
||||
{
|
||||
"stage": "Fragment",
|
||||
"backend": "Vulkan",
|
||||
"language": "GLSL",
|
||||
"source": "depth-only.frag.vk.glsl"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// XC_BUILTIN_DEPTH_ONLY_OPENGL_VS
|
||||
#version 430
|
||||
layout(location = 0) in vec3 aPosition;
|
||||
|
||||
layout(std140, binding = 0) uniform PerObjectConstants {
|
||||
mat4 gProjectionMatrix;
|
||||
mat4 gViewMatrix;
|
||||
mat4 gModelMatrix;
|
||||
};
|
||||
|
||||
void main() {
|
||||
vec4 positionWS = gModelMatrix * vec4(aPosition, 1.0);
|
||||
vec4 positionVS = gViewMatrix * positionWS;
|
||||
gl_Position = gProjectionMatrix * positionVS;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// XC_BUILTIN_DEPTH_ONLY_VULKAN_VS
|
||||
#version 450
|
||||
layout(location = 0) in vec3 aPosition;
|
||||
|
||||
layout(set = 0, binding = 0, std140) uniform PerObjectConstants {
|
||||
mat4 gProjectionMatrix;
|
||||
mat4 gViewMatrix;
|
||||
mat4 gModelMatrix;
|
||||
};
|
||||
|
||||
void main() {
|
||||
vec4 positionWS = gModelMatrix * vec4(aPosition, 1.0);
|
||||
vec4 positionVS = gViewMatrix * positionWS;
|
||||
gl_Position = gProjectionMatrix * positionVS;
|
||||
}
|
||||
22
engine/assets/builtin/shaders/depth-only/depth-only.vs.hlsl
Normal file
22
engine/assets/builtin/shaders/depth-only/depth-only.vs.hlsl
Normal file
@@ -0,0 +1,22 @@
|
||||
// XC_BUILTIN_DEPTH_ONLY_D3D12_VS
|
||||
cbuffer PerObjectConstants : register(b0) {
|
||||
float4x4 gProjectionMatrix;
|
||||
float4x4 gViewMatrix;
|
||||
float4x4 gModelMatrix;
|
||||
};
|
||||
|
||||
struct VSInput {
|
||||
float3 position : POSITION;
|
||||
};
|
||||
|
||||
struct PSInput {
|
||||
float4 position : SV_POSITION;
|
||||
};
|
||||
|
||||
PSInput MainVS(VSInput input) {
|
||||
PSInput output;
|
||||
float4 positionWS = mul(gModelMatrix, float4(input.position, 1.0));
|
||||
float4 positionVS = mul(gViewMatrix, positionWS);
|
||||
output.position = mul(gProjectionMatrix, positionVS);
|
||||
return output;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// XC_BUILTIN_SHADOW_CASTER_OPENGL_PS
|
||||
#version 430
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
fragColor = vec4(0.0);
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
// XC_BUILTIN_SHADOW_CASTER_VULKAN_PS
|
||||
#version 450
|
||||
layout(location = 0) out vec4 fragColor;
|
||||
|
||||
void main() {
|
||||
fragColor = vec4(0.0);
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
// XC_BUILTIN_SHADOW_CASTER_D3D12_PS
|
||||
struct PSInput {
|
||||
float4 position : SV_POSITION;
|
||||
};
|
||||
|
||||
float4 MainPS(PSInput input) : SV_TARGET {
|
||||
return float4(0.0, 0.0, 0.0, 0.0);
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
{
|
||||
"name": "Builtin Shadow Caster",
|
||||
"passes": [
|
||||
{
|
||||
"name": "ShadowCaster",
|
||||
"tags": {
|
||||
"LightMode": "ShadowCaster"
|
||||
},
|
||||
"resources": [
|
||||
{
|
||||
"name": "PerObjectConstants",
|
||||
"type": "ConstantBuffer",
|
||||
"set": 0,
|
||||
"binding": 0,
|
||||
"semantic": "PerObject"
|
||||
}
|
||||
],
|
||||
"variants": [
|
||||
{
|
||||
"stage": "Vertex",
|
||||
"backend": "D3D12",
|
||||
"language": "HLSL",
|
||||
"source": "shadow-caster.vs.hlsl",
|
||||
"entryPoint": "MainVS",
|
||||
"profile": "vs_5_0"
|
||||
},
|
||||
{
|
||||
"stage": "Fragment",
|
||||
"backend": "D3D12",
|
||||
"language": "HLSL",
|
||||
"source": "shadow-caster.ps.hlsl",
|
||||
"entryPoint": "MainPS",
|
||||
"profile": "ps_5_0"
|
||||
},
|
||||
{
|
||||
"stage": "Vertex",
|
||||
"backend": "OpenGL",
|
||||
"language": "GLSL",
|
||||
"source": "shadow-caster.vert.glsl"
|
||||
},
|
||||
{
|
||||
"stage": "Fragment",
|
||||
"backend": "OpenGL",
|
||||
"language": "GLSL",
|
||||
"source": "shadow-caster.frag.glsl"
|
||||
},
|
||||
{
|
||||
"stage": "Vertex",
|
||||
"backend": "Vulkan",
|
||||
"language": "GLSL",
|
||||
"source": "shadow-caster.vert.vk.glsl"
|
||||
},
|
||||
{
|
||||
"stage": "Fragment",
|
||||
"backend": "Vulkan",
|
||||
"language": "GLSL",
|
||||
"source": "shadow-caster.frag.vk.glsl"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// XC_BUILTIN_SHADOW_CASTER_OPENGL_VS
|
||||
#version 430
|
||||
layout(location = 0) in vec3 aPosition;
|
||||
|
||||
layout(std140, binding = 0) uniform PerObjectConstants {
|
||||
mat4 gProjectionMatrix;
|
||||
mat4 gViewMatrix;
|
||||
mat4 gModelMatrix;
|
||||
};
|
||||
|
||||
void main() {
|
||||
vec4 positionWS = gModelMatrix * vec4(aPosition, 1.0);
|
||||
vec4 positionVS = gViewMatrix * positionWS;
|
||||
gl_Position = gProjectionMatrix * positionVS;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
// XC_BUILTIN_SHADOW_CASTER_VULKAN_VS
|
||||
#version 450
|
||||
layout(location = 0) in vec3 aPosition;
|
||||
|
||||
layout(set = 0, binding = 0, std140) uniform PerObjectConstants {
|
||||
mat4 gProjectionMatrix;
|
||||
mat4 gViewMatrix;
|
||||
mat4 gModelMatrix;
|
||||
};
|
||||
|
||||
void main() {
|
||||
vec4 positionWS = gModelMatrix * vec4(aPosition, 1.0);
|
||||
vec4 positionVS = gViewMatrix * positionWS;
|
||||
gl_Position = gProjectionMatrix * positionVS;
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
// XC_BUILTIN_SHADOW_CASTER_D3D12_VS
|
||||
cbuffer PerObjectConstants : register(b0) {
|
||||
float4x4 gProjectionMatrix;
|
||||
float4x4 gViewMatrix;
|
||||
float4x4 gModelMatrix;
|
||||
};
|
||||
|
||||
struct VSInput {
|
||||
float3 position : POSITION;
|
||||
};
|
||||
|
||||
struct PSInput {
|
||||
float4 position : SV_POSITION;
|
||||
};
|
||||
|
||||
PSInput MainVS(VSInput input) {
|
||||
PSInput output;
|
||||
float4 positionWS = mul(gModelMatrix, float4(input.position, 1.0));
|
||||
float4 positionVS = mul(gViewMatrix, positionWS);
|
||||
output.position = mul(gProjectionMatrix, positionVS);
|
||||
return output;
|
||||
}
|
||||
Reference in New Issue
Block a user