diff --git a/zenovis/src/optx/RenderEngineOptx.cpp b/zenovis/src/optx/RenderEngineOptx.cpp index 86dfb398e5..3a52826c72 100644 --- a/zenovis/src/optx/RenderEngineOptx.cpp +++ b/zenovis/src/optx/RenderEngineOptx.cpp @@ -1372,7 +1372,8 @@ struct RenderEngineOptx : RenderEngine, zeno::disable_copy { ensure_shadtmpl(_volume_shader_template); ensure_shadtmpl(_light_shader_template); - if (cachedMeshesMaterials.count("Default")) { + //if (cachedMeshesMaterials.count("Default")) + { auto tmp = std::make_shared(); tmp->mark = ShaderMark::Mesh; @@ -1385,7 +1386,8 @@ struct RenderEngineOptx : RenderEngine, zeno::disable_copy { meshMatLUT.insert({"Default", 0}); } - if (cachedSphereMaterials.count("Default")) { + //if (cachedSphereMaterials.count("Default")) + { auto tmp = std::make_shared(); tmp->mark = ShaderMark::Sphere; diff --git a/zenovis/xinxinoptix/optixPathTracer.cpp b/zenovis/xinxinoptix/optixPathTracer.cpp index 1122010de4..7e114534fc 100644 --- a/zenovis/xinxinoptix/optixPathTracer.cpp +++ b/zenovis/xinxinoptix/optixPathTracer.cpp @@ -744,8 +744,10 @@ static void buildMeshAccel( PathTracerState& state, std::shared_ptr m ) ); // // Build triangle GAS // // One per SBT record for this build input + auto numSbtRecords = g_mtlidlut.empty() ? 1 : g_mtlidlut.size(); + std::vector triangle_input_flags(//MAT_COUNT - g_mtlidlut.size(), + numSbtRecords, OPTIX_GEOMETRY_FLAG_REQUIRE_SINGLE_ANYHIT_CALL); OptixBuildInput triangle_input = {}; @@ -755,7 +757,7 @@ static void buildMeshAccel( PathTracerState& state, std::shared_ptr m triangle_input.triangleArray.numVertices = static_cast( mesh->vertices.size() ); triangle_input.triangleArray.vertexBuffers = mesh->vertices.empty() ? nullptr : &dverts; triangle_input.triangleArray.flags = triangle_input_flags.data(); - triangle_input.triangleArray.numSbtRecords = mesh->vertices.empty() ? 1 : g_mtlidlut.size(); + triangle_input.triangleArray.numSbtRecords = numSbtRecords; triangle_input.triangleArray.sbtIndexOffsetBuffer = dmats; triangle_input.triangleArray.sbtIndexOffsetSizeInBytes = sizeof( uint32_t ); triangle_input.triangleArray.sbtIndexOffsetStrideInBytes = sizeof( uint32_t );