diff --git a/assets/shaders/celestial.frag.glsl b/assets/shaders/celestial.frag.glsl index 8ccd7eb7..a3d673b9 100644 --- a/assets/shaders/celestial.frag.glsl +++ b/assets/shaders/celestial.frag.glsl @@ -37,8 +37,8 @@ void main() { // Combine disc and glow float alpha = max(disc, glow) * push.intensity; - // Fade to zero at quad edges to prevent visible box - float edgeFade = 1.0 - smoothstep(0.4, 0.5, dist); + // Fade to zero well before quad edges + float edgeFade = 1.0 - smoothstep(0.35, 0.48, dist); alpha *= edgeFade; vec3 color = push.celestialColor.rgb; @@ -56,6 +56,7 @@ void main() { float phaseShadow = smoothstep(-0.1, 0.1, phaseX); alpha *= mix(phaseShadow, 1.0, step(0.5, push.intensity)); - if (alpha < 0.001) discard; - outColor = vec4(color, alpha); + if (alpha < 0.003) discard; + // Pre-multiply for additive blending: RGB is the light contribution + outColor = vec4(color * alpha, alpha); } diff --git a/assets/shaders/celestial.frag.spv b/assets/shaders/celestial.frag.spv index d5875791..9716ef19 100644 Binary files a/assets/shaders/celestial.frag.spv and b/assets/shaders/celestial.frag.spv differ diff --git a/src/rendering/celestial.cpp b/src/rendering/celestial.cpp index 34090fe5..798ac5d5 100644 --- a/src/rendering/celestial.cpp +++ b/src/rendering/celestial.cpp @@ -85,7 +85,7 @@ bool Celestial::initialize(VkContext* ctx, VkDescriptorSetLayout perFrameLayout) .setTopology(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST) .setRasterization(VK_POLYGON_MODE_FILL, VK_CULL_MODE_NONE) .setDepthTest(true, false, VK_COMPARE_OP_LESS_OR_EQUAL) // test on, write off (sky layer) - .setColorBlendAttachment(PipelineBuilder::blendAlpha()) + .setColorBlendAttachment(PipelineBuilder::blendAdditive()) .setMultisample(vkCtx_->getMsaaSamples()) .setLayout(pipelineLayout_) .setRenderPass(vkCtx_->getImGuiRenderPass()) @@ -157,7 +157,7 @@ void Celestial::recreatePipelines() { .setTopology(VK_PRIMITIVE_TOPOLOGY_TRIANGLE_LIST) .setRasterization(VK_POLYGON_MODE_FILL, VK_CULL_MODE_NONE) .setDepthTest(true, false, VK_COMPARE_OP_LESS_OR_EQUAL) - .setColorBlendAttachment(PipelineBuilder::blendAlpha()) + .setColorBlendAttachment(PipelineBuilder::blendAdditive()) .setMultisample(vkCtx_->getMsaaSamples()) .setLayout(pipelineLayout_) .setRenderPass(vkCtx_->getImGuiRenderPass())