Skip to content

Commit

Permalink
Fix miss material lookup
Browse files Browse the repository at this point in the history
  • Loading branch information
iaomw committed Oct 18, 2024
1 parent 05e7d76 commit 0c45cbd
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
6 changes: 4 additions & 2 deletions zenovis/src/optx/RenderEngineOptx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<ShaderPrepared>();

tmp->mark = ShaderMark::Mesh;
Expand All @@ -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<ShaderPrepared>();

tmp->mark = ShaderMark::Sphere;
Expand Down
6 changes: 4 additions & 2 deletions zenovis/xinxinoptix/optixPathTracer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -744,8 +744,10 @@ static void buildMeshAccel( PathTracerState& state, std::shared_ptr<smallMesh> m
) );

// // Build triangle GAS // // One per SBT record for this build input
auto numSbtRecords = g_mtlidlut.empty() ? 1 : g_mtlidlut.size();

std::vector<uint32_t> triangle_input_flags(//MAT_COUNT
g_mtlidlut.size(),
numSbtRecords,
OPTIX_GEOMETRY_FLAG_REQUIRE_SINGLE_ANYHIT_CALL);

OptixBuildInput triangle_input = {};
Expand All @@ -755,7 +757,7 @@ static void buildMeshAccel( PathTracerState& state, std::shared_ptr<smallMesh> m
triangle_input.triangleArray.numVertices = static_cast<uint32_t>( 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 );
Expand Down

0 comments on commit 0c45cbd

Please sign in to comment.