From 679d0eb585aca115ed126bac114b79feea126614 Mon Sep 17 00:00:00 2001 From: Sergey Yablokov Date: Sat, 6 Apr 2024 23:17:54 +0200 Subject: [PATCH] Mark all TLAS instances opaque --- internal/SceneDX.cpp | 2 +- internal/SceneVK.cpp | 5 +---- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/internal/SceneDX.cpp b/internal/SceneDX.cpp index 5e0f4cbb3..85005bfab 100644 --- a/internal/SceneDX.cpp +++ b/internal/SceneDX.cpp @@ -325,7 +325,7 @@ void Ray::Dx::Scene::Rebuild_HWRT_TLAS_nolock() { new_instance.InstanceID = meshes_[instance.mesh_index].vert_index / 3; new_instance.InstanceMask = (instance.ray_visibility & 0xff); new_instance.InstanceContributionToHitGroupIndex = 0; - new_instance.Flags = 0; + new_instance.Flags = D3D12_RAYTRACING_INSTANCE_FLAG_FORCE_OPAQUE; new_instance.AccelerationStructure = dx_blas.gpu_virtual_address(); // const mesh_t &mesh = meshes_[instance.mesh_index]; diff --git a/internal/SceneVK.cpp b/internal/SceneVK.cpp index 176853bb9..133d724b1 100644 --- a/internal/SceneVK.cpp +++ b/internal/SceneVK.cpp @@ -505,12 +505,9 @@ void Ray::Vk::Scene::Rebuild_HWRT_TLAS_nolock() { auto &new_instance = tlas_instances.back(); to_khr_xform(instance.xform, new_instance.transform.matrix); new_instance.instanceCustomIndex = m.vert_index / 3; - // blas.geo_index; new_instance.mask = (instance.ray_visibility & 0xff); new_instance.instanceShaderBindingTableRecordOffset = 0; - new_instance.flags = 0; - // VK_GEOMETRY_INSTANCE_TRIANGLE_FRONT_COUNTERCLOCKWISE_BIT_KHR; // - // VK_GEOMETRY_INSTANCE_TRIANGLE_FACING_CULL_DISABLE_BIT_KHR; + new_instance.flags = VK_GEOMETRY_INSTANCE_FORCE_OPAQUE_BIT_KHR; new_instance.accelerationStructureReference = static_cast(vk_blas.vk_device_address()); // const mesh_t &mesh = meshes_[instance.mesh_index];