Skip to content

Commit

Permalink
Merge pull request #724 from w23/stream-E355
Browse files Browse the repository at this point in the history
Stuff done during stream E355

- [x] fix accidental translucency for alpha-masked geometries: #721
  • Loading branch information
w23 authored Jan 1, 2024
2 parents 84babdf + 9088ab3 commit 6ffaad0
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions ref/vk/shaders/ray_primary_hit.glsl
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 6ffaad0

Please sign in to comment.