Commit 1e1a799f authored by Laurent Belcour's avatar Laurent Belcour
Browse files

Merge

parents b8c75f83 f2db9f61
......@@ -39,7 +39,7 @@ you will need the following command:
\a brdf2brdf converts an ALTA brdf file into another format such as
Matlab m file, C++ code, or BRDF Explorer shader. Note that this tool cannot
convert to another ALTA file (e.g. converting a Blinn lobe to a Beckmann
convert to another ALTA file (e.g., converting a Blinn lobe to a Beckmann
distribution).
<br />
......@@ -116,8 +116,7 @@ a Beckmann lobe (note there is no shadowing term, nor Fresnel term):
<!-- Define the function to use -->
<function name="nonlinear_function_diffuse" />
<function name="nonlinear_function_beckmann">
</function>
<function name="nonlinear_function_beckmann" />
<!-- Define the ftting procedure to use -->
<plugin type="fitter" name="nonlinear_fitter_ceres" />
......
......@@ -63,7 +63,7 @@ if compile_test:
#end
#cmake_cmd = 'cmake -DGLOG_LIB=' + build_dir + 'lib' + os.sep + libname + ' -DGLOG_INCLUDE=' + build_dir + 'include -DGFLAGS=OFF ' + '-DEIGEN_INCLUDE=' + build_dir + 'include -DCMAKE_INSTALL_PREFIX=' + build_dir + ' .' + ' -DDISABLE_TR1=ON -DBUILD_EXAMPLES=OFF ' + '-DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release -DMINIGLOG=OFF'
cmake_cmd = 'cmake -DBUILD_SHARED_LIBS=ON -DGLOG_LIB=' + build_dir + 'lib' + ' -DGLOG_INCLUDE=' + build_dir + 'include -DGFLAGS=OFF ' + '-DEIGEN_INCLUDE=' + build_dir + 'include -DCMAKE_INSTALL_PREFIX=' + build_dir + ' .' + ' -DDISABLE_TR1=ON -DBUILD_EXAMPLES=OFF ' + '-DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release -DMINIGLOG=ON'
cmake_cmd = 'cmake -DBUILD_SHARED_LIBS=OFF -DGLOG_LIB=' + build_dir + 'lib' + ' -DGLOG_INCLUDE=' + build_dir + 'include -DGFLAGS=OFF ' + '-DEIGEN_INCLUDE=' + build_dir + 'include -DCMAKE_INSTALL_PREFIX=' + build_dir + ' .' + ' -DDISABLE_TR1=ON -DBUILD_EXAMPLES=OFF ' + '-DBUILD_TESTING=OFF -DCMAKE_BUILD_TYPE=Release -DMINIGLOG=ON'
if os.name == 'nt':
ret = os.system(cmake_cmd + ' -G \"NMake Makefiles\"')
......
......@@ -23,13 +23,14 @@ std::map<params::input, const param_info> create_map()
/* 2D Params */
_map.insert(std::make_pair<params::input, const param_info>(params::RUSIN_TH_TD, param_info("RUSIN_TH_TD", 2, "Radialy symmetric Half angle parametrization")));
_map.insert(std::make_pair<params::input, const param_info>(params::COS_TH_TD, param_info("COS_TH_TD", 2, "Cosines of the elevation angles of the Half angle parametrization")));
_map.insert(std::make_pair<params::input, const param_info>(params::ISOTROPIC_TV_PROJ_DPHI, param_info("ISOTROPIC_TV_PROJ_DPHI", 2, "Isoptropic projected phi parametrization without a light direction.")));
/* 3D Params */
_map.insert(std::make_pair<params::input, const param_info>(params::RUSIN_TH_TD_PD, param_info("RUSIN_TH_TD_PD", 3, "Isotropic Half angle parametrization")));
_map.insert(std::make_pair<params::input, const param_info>(params::ISOTROPIC_TV_TL_DPHI, param_info("ISOTROPIC_TV_TL_DPHI", 3, "Isotropic Light/View angle parametrization")));
_map.insert(std::make_pair<params::input, const param_info>(params::RUSIN_VH, param_info("RUSIN_VH", 3, "Vector representation of the Half angle only")));
_map.insert(std::make_pair<params::input, const param_info>(params::SCHLICK_VK, param_info("SCHLICK_VH", 3, "Vector representation of the Back angle only")));
_map.insert(std::make_pair<params::input, const param_info>(params::SCHLICK_VK, param_info("SCHLICK_VH", 3, "Vector representation of the Back angle only")));
_map.insert(std::make_pair<params::input, const param_info>(params::ISOTROPIC_TL_TV_PROJ_DPHI, param_info("ISOTROPIC_TL_TV_PROJ_DPHI", 3, "Isoptropic projected phi parametrization.")));
_map.insert(std::make_pair<params::input, const param_info>(params::SCHLICK_TL_TK_PROJ_DPHI, param_info("SCHLICK_TL_TK_PROJ_DPHI", 3, "Isoptropic projected phi parametrization centered around the back vector.")));
_map.insert(std::make_pair<params::input, const param_info>(params::RETRO_TL_TVL_PROJ_DPHI, param_info("RETRO_TL_TVL_PROJ_DPHI", 3, "Isoptropic retro projected phi parametrization.")));
......@@ -498,6 +499,7 @@ void params::from_cartesian(const double* invec, params::input outtype,
}
params::input params::parse_input(const std::string& txt)
{
for(std::map<params::input, const param_info>::const_iterator it=input_map.begin(); it != input_map.end(); ++it)
{
if(txt.compare(it->second.name) == 0)
......
......@@ -37,58 +37,59 @@ class params
//! * The reflected vector is \f$\vec{r} = 2\mbox{dot}(\vec{v}, \vec{n})\vec{n} - \vec{v}\f$
enum input
{
RUSIN_TH_PH_TD_PD, /*!< Half-angle parametrization as described in [Rusinkiewicz'98] */
RUSIN_TH_PH_TD,
RUSIN_TH_TD_PD,
RUSIN_TH_TD, /*!< Half-angle parametrization with no azimutal information */
RUSIN_VH_VD, /*!< Half-angle parametrization in vector format. Coordinates are:
[\f$\vec{h}_x, \vec{h}_y, \vec{h}_z, \vec{d}_x, \vec{d}_y,
\vec{d}_z \f$].*/
RUSIN_VH, /*!< Half-angle parametrization with no difference direction in
vector format. Coordinates are: [\f$\vec{h}_x, \vec{h}_y,
\vec{h}_z\f$]. */
COS_TH_TD,
COS_TH,
SCHLICK_TK_PK, /*!< Schlick's back vector parametrization */
SCHLICK_VK, /*!< Schlick's back vector */
SCHLICK_TL_TK_PROJ_DPHI,/*!< 3D Parametrization where the phi component is projected and
the parametrization is centered around the back direction.
\f$[\theta_L, x, y] = [\theta_L, \theta_K \cos(\phi_K), \theta_K \sin(\phi_K)]\f$*/
COS_TK, /*!< Schlick's back vector dot product with the normal */
RETRO_TL_TVL_PROJ_DPHI,/*!< 2D Parametrization where the phi component is projected and
the parametrization is centered around the retro direction
\f$[x, y] = [\theta_{VL} \cos(\Delta\phi), \theta_{VL}
\sin(\Delta\phi)]\f$.*/
STEREOGRAPHIC, /*!< Stereographic projection of the Light and View vectors */
SPHERICAL_TL_PL_TV_PV, /*!< Light and View vectors represented in spherical coordinates */
COS_TLV, /*!< Dot product between the Light and View vector */
COS_TLR, /*!< Dot product between the Light and Reflected vector */
ISOTROPIC_TV_TL, /*!< Light and View vectors represented in spherical coordinates, */
ISOTROPIC_TV_TL_DPHI, /*!< Light and View vectors represented in spherical coordinates,
with the difference of azimutal coordinates in the last component */
ISOTROPIC_TV_PROJ_DPHI,/*!< 2D Parametrization where the phi component is projected.
Coordinates are: [\f$\theta_v \cos(\Delta\phi), \theta_v
\sin(\Delta\phi).\f$]*/
ISOTROPIC_TL_TV_PROJ_DPHI,/*!< 3D Parametrization where the phi component is projected.
Coordinates are: [\f$\theta_l, \theta_v \cos(\Delta\phi),
\theta_v \sin(\Delta\phi).\f$]*/
ISOTROPIC_TD_PD, /*!< Difference between two directions such as R and H */
BARYCENTRIC_ALPHA_SIGMA, /*!< Barycentric parametrization defined in Stark et al. [2004].
Coordinates are: \f$[\alpha, \sigma] = [{1\over 2}(1 - \vec{l}\vec{v}),
(1-(\vec{h}.\vec{n})^2)(1 - \alpha)]\f$ */
CARTESIAN, /*!< View and Light vectors represented in cartesian coordinates.
We always pack the view vector first: \f$\vec{c} = [v.x, v.y,
v.z, l.x, l.y, l.z] \f$*/
UNKNOWN_INPUT /*!< Default behaviour. Only use this is you do not fit BRDF data */
RUSIN_TH_PH_TD_PD, /*!< Half-angle parametrization as described in [Rusinkiewicz'98] */
RUSIN_TH_PH_TD,
RUSIN_TH_TD_PD,
RUSIN_TH_TD, /*!< Half-angle parametrization with no azimutal information */
RUSIN_VH_VD, /*!< Half-angle parametrization in vector format. Coordinates are:
[\f$\vec{h}_x, \vec{h}_y, \vec{h}_z, \vec{d}_x, \vec{d}_y,
\vec{d}_z \f$].*/
RUSIN_VH, /*!< Half-angle parametrization with no difference direction in
vector format. Coordinates are: [\f$\vec{h}_x, \vec{h}_y,
\vec{h}_z\f$]. */
COS_TH_TD, /*!< Cosine of the RUSIN_TH_TD parametrization: Coordinates are in
$[\cos_\theta_h,\cos_\theta_d]$. */
COS_TH,
SCHLICK_TK_PK, /*!< Schlick's back vector parametrization */
SCHLICK_VK, /*!< Schlick's back vector */
SCHLICK_TL_TK_PROJ_DPHI,/*!< 3D Parametrization where the phi component is projected and
the parametrization is centered around the back direction.
\f$[\theta_L, x, y] = [\theta_L, \theta_K \cos(\phi_K), \theta_K \sin(\phi_K)]\f$*/
COS_TK, /*!< Schlick's back vector dot product with the normal */
RETRO_TL_TVL_PROJ_DPHI,/*!< 2D Parametrization where the phi component is projected and
the parametrization is centered around the retro direction
\f$[x, y] = [\theta_{VL} \cos(\Delta\phi), \theta_{VL}
\sin(\Delta\phi)]\f$.*/
STEREOGRAPHIC, /*!< Stereographic projection of the Light and View vectors */
SPHERICAL_TL_PL_TV_PV, /*!< Light and View vectors represented in spherical coordinates */
COS_TLV, /*!< Dot product between the Light and View vector */
COS_TLR, /*!< Dot product between the Light and Reflected vector */
ISOTROPIC_TV_TL, /*!< Light and View vectors represented in spherical coordinates, */
ISOTROPIC_TV_TL_DPHI, /*!< Light and View vectors represented in spherical coordinates,
with the difference of azimutal coordinates in the last component */
ISOTROPIC_TV_PROJ_DPHI,/*!< 2D Parametrization where the phi component is projected.
Coordinates are: [\f$\theta_v \cos(\Delta\phi), \theta_v
\sin(\Delta\phi).\f$]*/
ISOTROPIC_TL_TV_PROJ_DPHI,/*!< 3D Parametrization where the phi component is projected.
Coordinates are: [\f$\theta_l, \theta_v \cos(\Delta\phi),
\theta_v \sin(\Delta\phi).\f$]*/
ISOTROPIC_TD_PD, /*!< Difference between two directions such as R and H */
BARYCENTRIC_ALPHA_SIGMA, /*!< Barycentric parametrization defined in Stark et al. [2004].
Coordinates are: \f$[\alpha, \sigma] = [{1\over 2}(1 - \vec{l}\vec{v}),
(1-(\vec{h}.\vec{n})^2)(1 - \alpha)]\f$ */
CARTESIAN, /*!< View and Light vectors represented in cartesian coordinates.
We always pack the view vector first: \f$\vec{c} = [v.x, v.y,
v.z, l.x, l.y, l.z] \f$*/
UNKNOWN_INPUT /*!< Default behaviour. Only use this is you do not fit BRDF data */
};
//! \brief list of all supported parametrization for the output space.
......
......@@ -102,6 +102,13 @@ template<class T> class ptr
//! is incremented.
ptr<T>& operator=(const ptr<T>& a)
{
//RP: Check and avoid assignment to itself
if ( (void*) this == (void *) &a)
{
return *this;
}
_counter->decrement();
if(_counter->value() < 1)
{
......
......@@ -19,6 +19,10 @@ SConscript('nonlinear_function_isotropic_lafortune/SConscript')
# Building nonlinear masking functions
SConscript('nonlinear_shadowing_smith/SConscript')
# Building nonlinear Fresnel functions
SConscript('nonlinear_fresnel_schlick/SConscript')
SConscript('nonlinear_fresnel_normalized_schlick/SConscript')
# # Building rational fitters
SConscript('rational_fitter_eigen/SConscript')
SConscript('rational_fitter_leastsquare/SConscript')
......
Import('env')
env = env.Clone()
env.AppendUnique(LIBS = env['PLUGIN_LIB'])
sources = ['function.cpp']
env.SharedLibrary('../../build/nonlinear_fresnel_normalized_schlick', sources)
Import('env')
env = env.Clone()
env.AppendUnique(LIBS = env['PLUGIN_LIB'])
sources = ['function.cpp']
env.SharedLibrary('../../build/nonlinear_fresnel_schlick', sources)
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment