Skip to content
Snippets Groups Projects
Commit 53c30ffa authored by Alexander Gauggel's avatar Alexander Gauggel
Browse files

[#82] Add alpha test

parent 467e5c75
No related branches found
No related tags found
1 merge request!70Resolve "Voxel cone tracing"
......@@ -2,6 +2,13 @@
#extension GL_ARB_separate_shader_objects : enable
#extension GL_GOOGLE_include_directive : enable
void main() {
#include "perMeshResources.inc"
layout(location = 0) in vec2 passUV;
void main() {
float alpha = texture(sampler2D(albedoTexture, textureSampler), passUV).a;
if(alpha < 0.5){
discard;
}
}
\ No newline at end of file
......@@ -4,6 +4,9 @@
#extension GL_GOOGLE_include_directive : enable
layout(location = 0) in vec3 inPosition;
layout(location = 2) in vec2 inUV;
layout(location = 0) out vec2 passUV;
layout( push_constant ) uniform constants{
mat4 mvp;
......@@ -11,4 +14,5 @@ layout( push_constant ) uniform constants{
void main() {
gl_Position = mvp * vec4(inPosition, 1.0);
passUV = inUV;
}
\ No newline at end of file
......@@ -177,20 +177,6 @@ int main(int argc, const char** argv) {
vkcv::PassConfig prepassPassDefinition({ prepassAttachment }, msaa);
vkcv::PassHandle prepassPass = core.createPass(prepassPassDefinition);
vkcv::PipelineConfig prepassPipelineConfig{
depthPrepassShader,
windowWidth,
windowHeight,
prepassPass,
vertexLayout,
{},
true};
prepassPipelineConfig.m_culling = vkcv::CullMode::Back;
prepassPipelineConfig.m_multisampling = msaa;
prepassPipelineConfig.m_depthTest = vkcv::DepthTest::LessEqual;
vkcv::PipelineHandle prepassPipeline = core.createGraphicsPipeline(prepassPipelineConfig);
// create descriptor sets
vkcv::SamplerHandle colorSampler = core.createSampler(
vkcv::SamplerFilterType::LINEAR,
......@@ -264,13 +250,34 @@ int main(int argc, const char** argv) {
perMeshDescriptorSets.push_back(materialDescriptorSets[vertexGroup.materialIndex]);
}
// prepass pipeline
vkcv::DescriptorSetHandle prepassDescriptorSet = core.createDescriptorSet(std::vector<vkcv::DescriptorBinding>());
vkcv::PipelineConfig prepassPipelineConfig{
depthPrepassShader,
windowWidth,
windowHeight,
prepassPass,
vertexLayout,
{
core.getDescriptorSet(prepassDescriptorSet).layout,
core.getDescriptorSet(perMeshDescriptorSets[0]).layout },
true };
prepassPipelineConfig.m_culling = vkcv::CullMode::Back;
prepassPipelineConfig.m_multisampling = msaa;
prepassPipelineConfig.m_depthTest = vkcv::DepthTest::LessEqual;
vkcv::PipelineHandle prepassPipeline = core.createGraphicsPipeline(prepassPipelineConfig);
// forward pipeline
vkcv::PipelineConfig forwardPipelineConfig {
forwardProgram,
windowWidth,
windowHeight,
forwardPass,
vertexLayout,
{ core.getDescriptorSet(forwardShadingDescriptorSet).layout,
{
core.getDescriptorSet(forwardShadingDescriptorSet).layout,
core.getDescriptorSet(perMeshDescriptorSets[0]).layout },
true
};
......@@ -408,7 +415,9 @@ int main(int argc, const char** argv) {
drawcalls.push_back(vkcv::DrawcallInfo(meshes[i], {
vkcv::DescriptorSetUsage(0, core.getDescriptorSet(forwardShadingDescriptorSet).vulkanHandle),
vkcv::DescriptorSetUsage(1, core.getDescriptorSet(perMeshDescriptorSets[i]).vulkanHandle) }));
prepassDrawcalls.push_back(vkcv::DrawcallInfo(meshes[i], {}));
prepassDrawcalls.push_back(vkcv::DrawcallInfo(meshes[i], {
vkcv::DescriptorSetUsage(0, core.getDescriptorSet(prepassDescriptorSet).vulkanHandle),
vkcv::DescriptorSetUsage(1, core.getDescriptorSet(perMeshDescriptorSets[i]).vulkanHandle) }));
}
vkcv::SamplerHandle voxelSampler = core.createSampler(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment