Skip to content

Commit

Permalink
Merge pull request #1938 from zenustech/fix-vol-tex
Browse files Browse the repository at this point in the history
fix-vol-tex
  • Loading branch information
iaomw authored Jun 13, 2024
2 parents ea6f82e + b76d4f2 commit 28f0efe
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions zenovis/src/optx/RenderEngineOptx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1147,7 +1147,10 @@ struct RenderEngineOptx : RenderEngine, zeno::disable_copy {
std::vector<std::string> realNeedTexPaths;
for(auto const &[matkey, mtldet] : matMap) {
for(auto tex: mtldet->tex2Ds) {
if (cachedMeshesMaterials.count(mtldet->mtlidkey) > 0 || cachedSphereMaterials.count(mtldet->mtlidkey) > 0) {
if (cachedMeshesMaterials.count(mtldet->mtlidkey) > 0
|| cachedSphereMaterials.count(mtldet->mtlidkey) > 0
|| mtldet->parameters.find("vol") != std::string::npos
) {
realNeedTexPaths.emplace_back(tex->path);
}
}
Expand All @@ -1174,6 +1177,9 @@ struct RenderEngineOptx : RenderEngine, zeno::disable_copy {
for (const auto& need_remove_tex: needToRemoveTexPaths) {
OptixUtil::removeTexture(need_remove_tex);
}
for (const auto& realNeedTexPath: realNeedTexPaths) {
OptixUtil::addTexture(realNeedTexPath);
}
}
for(auto const &[matkey, mtldet] : matMap)
{
Expand Down Expand Up @@ -1231,14 +1237,9 @@ struct RenderEngineOptx : RenderEngine, zeno::disable_copy {
//std::cout<<callable<<std::endl;

std::vector<std::string> shaderTex;
int texid=0;
for(auto tex:mtldet->tex2Ds)
{
if (cachedMeshesMaterials.count(mtldet->mtlidkey) > 0) {
OptixUtil::addTexture(tex->path.c_str());
shaderTex.emplace_back(tex->path);
texid++;
}
shaderTex.emplace_back(tex->path);
}

ShaderPrepared shaderP;
Expand Down

0 comments on commit 28f0efe

Please sign in to comment.