Skip to content

Commit

Permalink
fix env caustics for MMLT
Browse files Browse the repository at this point in the history
  • Loading branch information
FROL256 committed Feb 27, 2019
1 parent 5c5d369 commit cfcf3ac
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
6 changes: 3 additions & 3 deletions hydra_app/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ Input::Input()
g_hydraApiDisableSceneLoadInfo = true;

//noWindow = false; ///< run 'console_main', else run 'window_main'
//inLibraryPath = "tests/test_42"; ///< cornell box with teapot
inLibraryPath = "tests/test_42_with_mirror";
inLibraryPath = "tests/test_42"; ///< cornell box with teapot
//inLibraryPath = "tests/test_42_with_mirror";
//inLibraryPath = "tests/test_223_small"; ///< cornell box with sphere
//inLibraryPath = "tests/test_224_sphere";
//inLibraryPath = "tests/test_224_sphere_microfacet";
Expand All @@ -21,7 +21,7 @@ Input::Input()
//inLibraryPath = "/home/frol/PROG/HydraAPI/main/tests_f/test_204";
//inLibraryPath = "/home/frol/temp/MMLT_notCaustics_scenelib";

inDevelopment = true; ///< recompile shaders each time; note that nvidia have their own shader cache!
inDevelopment = false; ///< recompile shaders each time; note that nvidia have their own shader cache!
inDeviceId = 0; ///< opencl device id
cpuFB = true; ///< store frame buffer on CPU. Automaticly enabled if
enableMLT = false; ///< if use MMLT, you MUST enable it early, when render process just started (here or via command line).
Expand Down
3 changes: 3 additions & 0 deletions hydra_drv/GPUOCLLayer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1200,6 +1200,9 @@ void GPUOCLLayer::BeginTracingPass()
const int maxBounce = m_vars.m_varsI[HRT_TRACE_DEPTH];
const int BURN_ITERS = m_vars.m_varsI[HRT_MMLT_BURN_ITERS];

//m_vars.m_flags |= HRT_ENABLE_PT_CAUSTICS;
//UpdateVarsOnGPU(m_vars);

if((m_vars.m_flags & HRT_ENABLE_SBPT) != 0)
{
#ifdef SBDPT_INDIRECT_ONLY
Expand Down
2 changes: 1 addition & 1 deletion hydra_drv/GPUOCLLayerAdvanced.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -584,7 +584,7 @@ void GPUOCLLayer::SBDPT_Pass(int minBounce, int maxBounce, int ITERS)
{
if(!MLT_IsAllocated())
{
size_t mltMem = MLT_Alloc(maxBounce + 1); // #TODO: maxBounce works too !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
size_t mltMem = MLT_Alloc(maxBounce); // #TODO: maxBounce works too !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
std::cout << "[AllocAll]: MEM(MLT) = " << mltMem / size_t(1024*1024) << "\tMB" << std::endl;
runKernel_ClearAllInternalTempBuffers(m_rays.MEGABLOCKSIZE);
memsetf4(m_rays.pathAuxColor, float4(0,0,0,0), m_rays.MEGABLOCKSIZE, 0);
Expand Down
8 changes: 5 additions & 3 deletions hydra_drv/RenderDriverRTE.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ bool RenderDriverRTE::UpdateSettings(pugi::xml_node a_settingsNode)
if ((m_initFlags & GPU_ALLOC_FOR_COMPACT_MLT) || (m_initFlags & GPU_MLT_ENABLED_AT_START))
{
vars.m_flags |= HRT_ENABLE_MMLT;
vars.m_flags |= HRT_ENABLE_PT_CAUSTICS;
m_renderMethod = RENDER_METHOD_MMLT;
}
else if(std::wstring(a_settingsNode.child(L"method_secondary").text().as_string()) == L"mmlt" ||
Expand Down Expand Up @@ -1618,16 +1619,17 @@ void RenderDriverRTE::Draw()
//
m_pHWLayer->InitPathTracing(m_legacy.m_lastSeed);
m_ptInitDone = true;

auto flagsAndVars = m_pHWLayer->GetAllFlagsAndVars();
flagsAndVars.m_flags |= HRT_UNIFIED_IMAGE_SAMPLING;
flagsAndVars.m_flags |= HRT_ENABLE_MMLT;

flagsAndVars.m_flags |= HRT_ENABLE_PT_CAUSTICS;

flagsAndVars.m_flags &= (~HRT_3WAY_MIS_WEIGHTS);
flagsAndVars.m_flags &= (~HRT_FORWARD_TRACING);
flagsAndVars.m_flags &= (~HRT_DRAW_LIGHT_LT);
flagsAndVars.m_flags &= (~HRT_ENABLE_SBPT);

m_pHWLayer->SetAllFlagsAndVars(flagsAndVars);
m_drawPassNumber = 0;
}
Expand Down

0 comments on commit cfcf3ac

Please sign in to comment.