vk: rt: fixup accidental translucency for alpha-masked geometries

Fixes #721
This commit is contained in:
Ivan Avdeev 2024-01-01 11:07:53 -05:00
parent 84babdfff8
commit 9088ab3dc4
1 changed files with 6 additions and 0 deletions

View File

@ -104,6 +104,12 @@ void primaryRayHit(rayQueryEXT rq, inout RayPayloadPrimary payload) {
payload.base_color_a *= color;
payload.emissive.rgb *= color.rgb;
// α-masked materials leak non-1 alpha values to bounces, leading to weird translucent edges, see
// https://github.com/w23/xash3d-fwgs/issues/721
// Non-translucent materials should be fully opaque
if (model.mode != MATERIAL_MODE_TRANSLUCENT)
payload.base_color_a.a = 1.;
if (ubo.ubo.debug_display_only == DEBUG_DISPLAY_DISABLED) {
// Nop
} else if (ubo.ubo.debug_display_only == DEBUG_DISPLAY_SURFHASH) {