From 44ca19788707b3254c37c5a4f227e97fa57682e6 Mon Sep 17 00:00:00 2001 From: FROL256 Date: Sun, 3 Mar 2019 17:10:43 +0300 Subject: [PATCH] fix MMLT direct light for env (2) --- hydra_app/input.cpp | 2 +- hydra_drv/shaders/material.cl | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/hydra_app/input.cpp b/hydra_app/input.cpp index 87cb343..87cc450 100644 --- a/hydra_app/input.cpp +++ b/hydra_app/input.cpp @@ -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 diff --git a/hydra_drv/shaders/material.cl b/hydra_drv/shaders/material.cl index 69f3a4f..fd63447 100644 --- a/hydra_drv/shaders/material.cl +++ b/hydra_drv/shaders/material.cl @@ -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)