Skip to content

Commit

Permalink
fix microfacet
Browse files Browse the repository at this point in the history
  • Loading branch information
FROL256 committed Nov 9, 2018
1 parent e383521 commit e12edb0
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ cmake-build-debug/CMakeFiles/FindOpenMP/ompver_CXX.bin
cmake-build-debug/hydra_app/CMakeFiles/hydra.dir/main.cpp.o
cmake-build-debug/hydra_app/Makefile
cmake-build-debug/hydra_app/cmake_install.cmake
cmake-build-debug/hydra_app/CMakeFiles/
cmake-build-debug/hydra_app/hydra
cmake-build-debug/hydra_app/CMakeFiles/CMakeDirectoryInformation.cmake
cmake-build-debug/hydra_app/CMakeFiles/progress.marks
Expand Down Expand Up @@ -297,3 +298,6 @@ hydra_drv/shaders/sort.xx
hydra_drv/shaders/trace.xx
.idea/.name
.idea/.name
hydra_app/CMakeFiles/Makefile.cmake
hydra_app/CMakeCache.txt
hydra_app/Makefile
9 changes: 5 additions & 4 deletions hydra_app/input.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@ 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_223_small"; ///< cornell box with sphere
inLibraryPath = "tests/test_42"; ///< cornell box with teapot
//inLibraryPath = "tests/test_223_small"; ///< cornell box with sphere
//inLibraryPath = "tests/test_224_gloss";
//inLibraryPath = "/media/frol/886234F06234E49A/scenes/benchmark4"; ///< cornell box with mirror glossy back wall
//inLibraryPath = "/media/frol/886234F06234E49A/scenes/phong_test/torspar1";
//inLibraryPath = "/media/frol/886234F06234E49A/scenes/cornell_water";

//inLibraryPath = "/home/frol/PROG/HydraAPI/main/tests/test_86";
//inLibraryPath = "/home/frol/temp/hydra_debug_scene";
//inLibraryPath = "/home/frol/PROG/HydraAPI/main/tests_f/test_203";
//inLibraryPath = "/home/frol/PROG/HydraAPI/main/tests_f/test_202";
//inLibraryPath = "/home/frol/PROG/HydraAPI/main/tests_f/test_173";
//inLibraryPath = "/home/frol/yandexdisk/Hydra/scenelib";

//inLibraryPath = "D:/[archive]/2017/HydraAPP/hydra_app/tests/hydra_benchmark_07";
Expand All @@ -29,7 +30,7 @@ Input::Input()
//inLibraryPath = "C:/[Hydra]/pluginFiles/scenelib";
//inLibraryPath = "D:/temp/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
6 changes: 3 additions & 3 deletions hydra_drv/cmaterial.h
Original file line number Diff line number Diff line change
Expand Up @@ -766,7 +766,7 @@ static inline float TorranceSparrowGF1(const float3 wo, const float3 wi) // in P
const float cosThetaH = dot(wi, wh);
const float F = FrCond(cosThetaH, 5.0f, 1.25f); // fresnel->Evaluate(cosThetaH);

return fmin(TorranceSparrowG1(wo, wi, wh) * F / fmax(4.f * cosThetaI * cosThetaO, DEPSILON), 1000.0f);
return fmin(TorranceSparrowG1(wo, wi, wh) * F / fmax(4.f * cosThetaI * cosThetaO, DEPSILON), 250.0f);
}

static inline float TorranceSparrowGF2(const float3 wo, const float3 wi, const float3 n) // in normal word coord system
Expand Down Expand Up @@ -828,7 +828,7 @@ static inline float blinnEvalPDF(__global const PlainMaterial* a_pMat, const flo
return blinn_pdf;
}

#define BLINN_COLOR_MULT 2.0f
#define BLINN_COLOR_MULT 2.25f

static inline float3 blinnEvalBxDF(__global const PlainMaterial* a_pMat, const float3 l, const float3 v, const float3 n,
const float2 a_texCoord, __global const EngineGlobals* a_globals, texture2d_t a_tex, __private const ProcTextureList* a_ptList)
Expand Down Expand Up @@ -897,7 +897,7 @@ static inline void BlinnSampleAndEvalBRDF(__global const PlainMaterial* a_pMat,
const float GF1 = TorranceSparrowGF1(wo, wi);

const float estimatedThoroughput = cosThetaOut*(D * GF1) / fmax(blinn_pdf, DEPSILON2);
const float brightBordersMult = fmin(estimatedThoroughput, 0.65f) / fmax(estimatedThoroughput, DEPSILON2);
const float brightBordersMult = fmin(estimatedThoroughput, 0.525f) / fmax(estimatedThoroughput, DEPSILON2);

a_out->direction = newDir;
a_out->pdf = blinn_pdf;
Expand Down

0 comments on commit e12edb0

Please sign in to comment.