As you can see in this picture, I can see the lower wood planks but not the higher ones when looking through the grass texture alpha
I’ve tried reversing my z buffer simply by changing my minDepth to 1, maxDepth to 0, changing the compare op to greater_or_equal, and turning the clear value to 0. And it looks slightly better, but I still have the same problem.
Could it be because I am using multidraw indirect with the terrain being in a single buffer? When I update the chunk a grass texture is in, most of the things behind the grass texture become visible, but some chunks that are very close behind are still invisible when looking through the grass alpha. Without updating the chunk it is much worse which explains the grass in the background that isn’t transparent at all.
Here is my code though it is pretty standard:
VkPipelineDepthStencilStateCreateInfo depthStencil{};
depthStencil.sType = VK_STRUCTURE_TYPE_PIPELINE_DEPTH_STENCIL_STATE_CREATE_INFO;
depthStencil.depthTestEnable = VK_TRUE;
depthStencil.depthWriteEnable = VK_TRUE;
depthStencil.depthCompareOp = VK_COMPARE_OP_GREATER_OR_EQUAL;// VK_COMPARE_OP_LESS;
depthStencil.depthBoundsTestEnable = VK_FALSE;
depthStencil.stencilTestEnable = VK_FALSE;
VkPipelineColorBlendAttachmentState colorBlendAttachment{};
colorBlendAttachment.colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT | VK_COLOR_COMPONENT_B_BIT;// | VK_COLOR_COMPONENT_A_BIT;
colorBlendAttachment.blendEnable = VK_TRUE;
colorBlendAttachment.srcColorBlendFactor = VK_BLEND_FACTOR_SRC_ALPHA;
colorBlendAttachment.dstColorBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
colorBlendAttachment.colorBlendOp = VK_BLEND_OP_ADD;
colorBlendAttachment.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE;
colorBlendAttachment.dstAlphaBlendFactor = VK_BLEND_FACTOR_ZERO;
colorBlendAttachment.alphaBlendOp = VK_BLEND_OP_ADD;
Do I need some depth-independent way of blending or have I overlooked something? Thanks!