mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-27 01:00:13 +00:00
Add player water ripples and separate 1x water pass for MSAA compatibility
Player interaction ripples: vertex shader adds radial damped-sine displacement centered on player position, fragment shader adds matching normal perturbation for specular highlights. Player XY packed into shadowParams.zw, ripple strength into fogParams.w. Separate 1x render pass for water when MSAA is active to avoid MSAA-induced darkening — water renders after main pass resolves, using the resolved swapchain image and depth resolve target. Water 1x framebuffers rebuilt on swapchain recreate (window resize).
This commit is contained in:
parent
67e63653a4
commit
03a62526e1
11 changed files with 1306 additions and 115 deletions
|
|
@ -90,6 +90,11 @@ PipelineBuilder& PipelineBuilder::setMultisample(VkSampleCountFlagBits samples)
|
|||
return *this;
|
||||
}
|
||||
|
||||
PipelineBuilder& PipelineBuilder::setAlphaToCoverage(bool enable) {
|
||||
alphaToCoverage_ = enable;
|
||||
return *this;
|
||||
}
|
||||
|
||||
PipelineBuilder& PipelineBuilder::setLayout(VkPipelineLayout layout) {
|
||||
pipelineLayout_ = layout;
|
||||
return *this;
|
||||
|
|
@ -145,6 +150,7 @@ VkPipeline PipelineBuilder::build(VkDevice device) const {
|
|||
multisampling.sType = VK_STRUCTURE_TYPE_PIPELINE_MULTISAMPLE_STATE_CREATE_INFO;
|
||||
multisampling.sampleShadingEnable = VK_FALSE;
|
||||
multisampling.rasterizationSamples = msaaSamples_;
|
||||
multisampling.alphaToCoverageEnable = alphaToCoverage_ ? VK_TRUE : VK_FALSE;
|
||||
|
||||
// Depth/stencil
|
||||
VkPipelineDepthStencilStateCreateInfo depthStencil{};
|
||||
|
|
@ -218,6 +224,20 @@ VkPipelineColorBlendAttachmentState PipelineBuilder::blendAlpha() {
|
|||
return state;
|
||||
}
|
||||
|
||||
VkPipelineColorBlendAttachmentState PipelineBuilder::blendPremultiplied() {
|
||||
VkPipelineColorBlendAttachmentState state{};
|
||||
state.colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT |
|
||||
VK_COLOR_COMPONENT_B_BIT | VK_COLOR_COMPONENT_A_BIT;
|
||||
state.blendEnable = VK_TRUE;
|
||||
state.srcColorBlendFactor = VK_BLEND_FACTOR_ONE;
|
||||
state.dstColorBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
|
||||
state.colorBlendOp = VK_BLEND_OP_ADD;
|
||||
state.srcAlphaBlendFactor = VK_BLEND_FACTOR_ONE;
|
||||
state.dstAlphaBlendFactor = VK_BLEND_FACTOR_ONE_MINUS_SRC_ALPHA;
|
||||
state.alphaBlendOp = VK_BLEND_OP_ADD;
|
||||
return state;
|
||||
}
|
||||
|
||||
VkPipelineColorBlendAttachmentState PipelineBuilder::blendAdditive() {
|
||||
VkPipelineColorBlendAttachmentState state{};
|
||||
state.colorWriteMask = VK_COLOR_COMPONENT_R_BIT | VK_COLOR_COMPONENT_G_BIT |
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue