star-sf

Set of surface and volume scattering functions
git clone git://git.meso-star.fr/star-sf.git
Log | Files | Refs | README | LICENSE

commit 8bbe0f6e6e8682e788633e71db304d2ce4dcc034
parent 8cb11ef86de32190de430a0337b5d4304383b386
Author: Christophe Coustet <christophe.coustet@meso-star.com>
Date:   Tue, 21 Nov 2017 14:52:25 +0100

Merge branch 'release_0.4' into develop

Diffstat:
MREADME.md | 7+++++++
Mcmake/CMakeLists.txt | 6+++---
Msrc/ssf_lambertian_reflection.c | 5++---
Msrc/test_ssf_microfacet_reflection.c | 8++++----
Msrc/test_ssf_utils.h | 5++---
5 files changed, 18 insertions(+), 13 deletions(-)

diff --git a/README.md b/README.md @@ -26,6 +26,13 @@ project from the `cmake/CMakeLists.txt` file by appending to the ## Release notes +### Version 0.4 + +- Fix the Blinn distribution. +- Change the microfacet distribution API to no longer require the unused + outgoing direction parameter. +- Use and require Star-SamPling version 0.5. + ### Version 0.3 - A BSDF is no more a composition of BxDFs: the caller writes directly the diff --git a/cmake/CMakeLists.txt b/cmake/CMakeLists.txt @@ -26,7 +26,7 @@ set(SSF_SOURCE_DIR ${PROJECT_SOURCE_DIR}/../src) ################################################################################ find_package(RCMake REQUIRED) find_package(RSys 0.4 REQUIRED) -find_package(StarSP 0.3 REQUIRED) +find_package(StarSP 0.5 REQUIRED) include_directories(${RSys_INCLUDE_DIR} ${StarSP_INCLUDE_DIR}) set(CMAKE_MODULE_PATH ${RCMAKE_SOURCE_DIR}) @@ -39,7 +39,7 @@ rcmake_append_runtime_dirs(_runtime_dirs RSys StarSP) # Define targets ################################################################################ set(VERSION_MAJOR 0) -set(VERSION_MINOR 3) +set(VERSION_MINOR 4) set(VERSION_PATCH 0) set(VERSION ${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}) @@ -75,7 +75,7 @@ if(CMAKE_COMPILER_IS_GNUCXX OR CMAKE_COMPILER_IS_GNUCC) endif() if(BUILD_STATIC) - add_library(ssf STATIC ${SSF_FILES_INC} ${SSF_FILES_SRC}) + add_library(ssf STATIC ${SSF_FILES_INC} ${SSF_FILES_SRC} ${SSF_FILES_INC_API}) set_target_properties(ssf PROPERTIES COMPILE_DEFINITIONS SSF_STATIC_BUILD) else() add_library(ssf SHARED ${SSF_FILES_INC} ${SSF_FILES_SRC}) diff --git a/src/ssf_lambertian_reflection.c b/src/ssf_lambertian_reflection.c @@ -63,14 +63,13 @@ lambertian_reflection_sample int* type, double* pdf) { - double sample[4]; + double sample[3]; ASSERT(data && rng && wo && N && wi && type && pdf); ASSERT(d3_is_normalized(wo) && d3_is_normalized(N) && d3_dot(wo, N) > 0); (void)wo; - ssp_ran_hemisphere_cos(rng, N, sample); + ssp_ran_hemisphere_cos(rng, N, sample, pdf); d3_set(wi, sample); - *pdf = sample[3]; *type = SSF_REFLECTION | SSF_DIFFUSE; return ((struct lambertian_reflection*)data)->reflectivity; } diff --git a/src/test_ssf_microfacet_reflection.c b/src/test_ssf_microfacet_reflection.c @@ -28,8 +28,8 @@ main(int argc, char** argv) struct ssf_fresnel* F; struct ssf_microfacet_distribution* D; struct ssp_rng* rng; - double N[4]; /* xyz, pdf */ - double wo[4]; /* xyz, pdf */ + double N[3]; + double wo[3]; size_t i, NSTEPS=100000; (void)argc, (void)argv; @@ -53,8 +53,8 @@ main(int argc, char** argv) CHECK(ssf_microfacet_reflection_setup(bsdf, F, D), RES_OK); /* Check energy conservation */ - ssp_ran_sphere_uniform(rng, N); - ssp_ran_hemisphere_cos(rng, N, wo); + ssp_ran_sphere_uniform(rng, N, NULL); + ssp_ran_hemisphere_cos(rng, N, wo, NULL); FOR_EACH(i, 0, NSTEPS) { double wi[3], pdf; int type; diff --git a/src/test_ssf_utils.h b/src/test_ssf_utils.h @@ -189,7 +189,7 @@ check_microfacet_distribution const size_t NSTEPS = 10000; size_t i; size_t n; - double sample[4]; + double sample[3]; double E, V, SE; double sum, sum2; @@ -204,9 +204,8 @@ check_microfacet_distribution do { FOR_EACH(i, 0, NSTEPS) { double wh[3], pdf, D, weight; - ssp_ran_hemisphere_cos(rng, N, sample); + ssp_ran_hemisphere_cos(rng, N, sample, &pdf); d3_set(wh, sample); - pdf = sample[3]; D = ssf_microfacet_distribution_eval(distrib, N, wh); weight = D * d3_dot(wh, N) / pdf; sum += weight;