Skip to content

Commit

Permalink
Merge pull request #1931 from zenustech/fix-optix-lightmap
Browse files Browse the repository at this point in the history
fix-optix-lightmap
  • Loading branch information
iaomw authored Jun 5, 2024
2 parents 06fcbf1 + 45a42b1 commit 4c8bfce
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 0 deletions.
9 changes: 9 additions & 0 deletions zenovis/src/optx/RenderEngineOptx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1152,6 +1152,15 @@ struct RenderEngineOptx : RenderEngine, zeno::disable_copy {
}
}
}
// add light map
for(auto const &[_, ld]: xinxinoptix::get_lightdats()) {
if (ld.profileKey.size()) {
realNeedTexPaths.emplace_back(ld.profileKey);
}
if (ld.textureKey.size()) {
realNeedTexPaths.emplace_back(ld.textureKey);
}
}
std::vector<std::string> needToRemoveTexPaths;
for(auto const &[tex, _]: OptixUtil::g_tex) {
if (std::find(realNeedTexPaths.begin(), realNeedTexPaths.end(), tex) != realNeedTexPaths.end()) {
Expand Down
5 changes: 5 additions & 0 deletions zenovis/xinxinoptix/optixPathTracer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2099,6 +2099,11 @@ static std::map<std::string, LightDat> lightdats;
static std::vector<float2> triangleLightCoords;
static std::vector<float3> triangleLightNormals;


std::map<std::string, LightDat> &get_lightdats() {
return lightdats;
}

void unload_light(){

lightdats.clear();
Expand Down
1 change: 1 addition & 0 deletions zenovis/xinxinoptix/xinxinoptixapi.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,5 @@ void using_hdr_sky(bool enable);
void show_background(bool enable);
// void optixUpdateUniforms(std::vector<float4> & inConstants);
void optixUpdateUniforms(void *inConstants, std::size_t size);
std::map<std::string, LightDat> &get_lightdats();
}

0 comments on commit 4c8bfce

Please sign in to comment.