mirror of
https://github.com/Kelsidavis/WoWee.git
synced 2026-03-22 23:30:14 +00:00
Fix foliage DXT black fringe, insect depth occlusion, and ambient creature animation
- Replace dark edge RGB on alpha-tested foliage with mip-4 average color proportional to alpha (low alpha = low trust in original RGB) - Raise foliage alpha cutoff to 0.4 and remove dither band for cleaner edges - Disable depth test on insect particles so they don't vanish behind foliage - Exempt dragonflies/butterflies/moths from foliage animation freeze
This commit is contained in:
parent
01c08b93b0
commit
a7102ab742
3 changed files with 17 additions and 18 deletions
|
|
@ -66,27 +66,26 @@ void main() {
|
|||
|
||||
bool isFoliage = (alphaTest == 2);
|
||||
|
||||
// Fix DXT fringe: transparent edge texels have garbage (black) RGB.
|
||||
// At low alpha the original RGB is untrustworthy — replace with the
|
||||
// averaged color from nearby opaque texels (high mip). The lower
|
||||
// the alpha the more we distrust the original color.
|
||||
if (alphaTest != 0 && texColor.a > 0.01 && texColor.a < 1.0) {
|
||||
vec3 mipColor = textureLod(uTexture, TexCoord, 4.0).rgb;
|
||||
// trust = 0 at alpha 0, trust = 1 at alpha ~0.9
|
||||
float trust = smoothstep(0.0, 0.9, texColor.a);
|
||||
texColor.rgb = mix(mipColor, texColor.rgb, trust);
|
||||
}
|
||||
|
||||
float alphaCutoff = 0.5;
|
||||
if (alphaTest == 2) {
|
||||
// Vegetation cutout: lower threshold to preserve leaf coverage at grazing angles.
|
||||
alphaCutoff = 0.33;
|
||||
alphaCutoff = 0.4;
|
||||
} else if (alphaTest == 3) {
|
||||
// Ground detail clutter (grass/small cards) needs softer clipping.
|
||||
alphaCutoff = 0.20;
|
||||
alphaCutoff = 0.25;
|
||||
} else if (alphaTest != 0) {
|
||||
alphaCutoff = 0.35;
|
||||
alphaCutoff = 0.4;
|
||||
}
|
||||
if (alphaTest == 2) {
|
||||
float alpha = texColor.a;
|
||||
float softBand = 0.15;
|
||||
if (alpha < (alphaCutoff - softBand)) discard;
|
||||
if (alpha < alphaCutoff) {
|
||||
ivec2 p = ivec2(gl_FragCoord.xy);
|
||||
float threshold = bayerDither4x4(p);
|
||||
float keep = clamp((alpha - (alphaCutoff - softBand)) / softBand, 0.0, 1.0);
|
||||
if (threshold > keep) discard;
|
||||
}
|
||||
} else if (alphaTest != 0 && texColor.a < alphaCutoff) {
|
||||
if (alphaTest != 0 && texColor.a < alphaCutoff) {
|
||||
discard;
|
||||
}
|
||||
if (colorKeyBlack != 0) {
|
||||
|
|
|
|||
Binary file not shown.
|
|
@ -180,7 +180,7 @@ bool SwimEffects::initialize(VkContext* ctx, VkDescriptorSetLayout perFrameLayou
|
|||
.setVertexInput({binding}, attrs)
|
||||
.setTopology(VK_PRIMITIVE_TOPOLOGY_POINT_LIST)
|
||||
.setRasterization(VK_POLYGON_MODE_FILL, VK_CULL_MODE_NONE)
|
||||
.setDepthTest(true, false, VK_COMPARE_OP_LESS)
|
||||
.setDepthTest(false, false, VK_COMPARE_OP_LESS)
|
||||
.setColorBlendAttachment(PipelineBuilder::blendAlpha())
|
||||
.setMultisample(vkCtx->getMsaaSamples())
|
||||
.setLayout(insectPipelineLayout)
|
||||
|
|
@ -414,7 +414,7 @@ void SwimEffects::recreatePipelines() {
|
|||
.setVertexInput({binding}, attrs)
|
||||
.setTopology(VK_PRIMITIVE_TOPOLOGY_POINT_LIST)
|
||||
.setRasterization(VK_POLYGON_MODE_FILL, VK_CULL_MODE_NONE)
|
||||
.setDepthTest(true, false, VK_COMPARE_OP_LESS)
|
||||
.setDepthTest(false, false, VK_COMPARE_OP_LESS)
|
||||
.setColorBlendAttachment(PipelineBuilder::blendAlpha())
|
||||
.setMultisample(vkCtx->getMsaaSamples())
|
||||
.setLayout(insectPipelineLayout)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue