Skip to content

Commit

Permalink
fix MMLT direct light for env (2)
Browse files Browse the repository at this point in the history
  • Loading branch information
FROL256 committed Mar 3, 2019
1 parent f852ecb commit 44ca197
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
2 changes: 1 addition & 1 deletion hydra_app/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ Input::Input()
//inLibraryPath = "tests/test_pool";
//inLibraryPath = "/home/frol/temp/suncg1_scenelib/statex_00003.xml";
//inLibraryPath = "/home/frol/PROG/HydraAPI/main/tests_f/test_204";
//inLibraryPath = "/home/frol/temp/MMLT_notCaustics_scenelib";
//inLibraryPath = "/home/frol/PROG/HydraAPI/main/tests_a/test_406";

inDevelopment = false; ///< recompile shaders each time; note that nvidia have their own shader cache!
inDeviceId = 0; ///< opencl device id
Expand Down
11 changes: 7 additions & 4 deletions hydra_drv/shaders/material.cl
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,13 @@ __kernel void HitEnvOrLightKernel(__global const float4* restrict in_rpos,
a_globals, in_mtlStorage, in_pdfStorage, in_texStorage1);

////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Direct/Indirect Light for MMLT/KMLT
if(evalDirectLightOnly && !flagsHaveOnlySpecular(flags) && rayBounceNum > 1) // exclude indirect light
envColor = make_float3(0,0,0);
else if(evalIndirectLightOnly && (rayBounceNum <= 1 || flagsHaveOnlySpecular(flags))) // exclude direct light and pure reflections
envColor = make_float3(0,0,0);
{
const uint otherFlags = unpackRayFlags(flags);
if(evalDirectLightOnly && !flagsHaveOnlySpecular(flags) && rayBounceNum > 1 && ((otherFlags & RAY_WILL_DIE_NEXT_BOUNCE) == 0)) // exclude indirect light
envColor = make_float3(0,0,0);
else if(evalIndirectLightOnly && (rayBounceNum <= 1 || flagsHaveOnlySpecular(flags))) // exclude direct light and pure reflections
envColor = make_float3(0,0,0);
}
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// Direct/Indirect Light for MMLT/KMLT

if(a_currDepth + 1 < a_minDepth)
Expand Down

0 comments on commit 44ca197

Please sign in to comment.