Commit 4e11dcdb authored by Laurent Belcour's avatar Laurent Belcour

The Beckmann distribution wasn't working due to the lack of correct Jacobian...

The Beckmann distribution wasn't working due to the lack of correct Jacobian for the Geometric term. I commented the Geometric term from the BRDF to get correct fit. Will need to work on that.
parent 6ddcbd54
......@@ -22,7 +22,6 @@ 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::ISOTROPIC_TV_PROJ_DPHI, param_info("ISOTROPIC_TV_PROJ_DPHI", 2, "Isoptropic projected phi parametrization without a light direction.")));
_map.insert(std::make_pair<params::input, const param_info>(params::ISOTROPIC_TV_PROJ_DPHI, param_info("THETA_OUT_COS_DPHI_THETA_OUT_SIN_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")));
......
......@@ -48,7 +48,7 @@ vec beckmann_function::value(const vec& x) const
params::convert(&x[0], params::CARTESIAN, params::RUSIN_VH, &h[0]);
// Compute the Shadow term to init res
vec res = G(x);
vec res = vec::Zero(dimY()); //G(x);
for(int i=0; i<dimY(); ++i)
{
......@@ -59,11 +59,11 @@ vec beckmann_function::value(const vec& x) const
if(h[2] > 0.0 && x[2]*x[5]>0.0)
{
res[i] *= _ks[i] / (4.0 * x[2]*x[5] * M_PI * a2 * dh2*dh2) * expo;
res[i] = _ks[i] / (4.0 * x[2]*x[5] * M_PI * a2 * dh2*dh2) * expo;
}
else
{
res[i] *= 0.0;
res[i] = 0.0;
}
}
return res;
......@@ -129,7 +129,7 @@ vec beckmann_function::parametersJacobian(const vec& x) const
params::convert(&x[0], params::CARTESIAN, params::RUSIN_VH, h);
// Get the geometry term
vec g = G(x);
//vec g = G(x);
vec jac(dimY()*nbParameters());
for(int i=0; i<dimY(); ++i)
......@@ -145,10 +145,10 @@ vec beckmann_function::parametersJacobian(const vec& x) const
const double fac = (4.0 * x[2]*x[5] * M_PI * a2 * dh2*dh2);
// df / dk_s
jac[i*nbParameters() + j*2+0] = g[i] * expo / fac;
jac[i*nbParameters() + j*2+0] = /*g[i] */ expo / fac;
// df / da_x
jac[i*nbParameters() + j*2+1] = - g[i] * _ks[i] * (expo/(4.0*x[2]*x[5])) * ((2* a * h[2])/(M_PI*a2*a2*dh2)) * (1 + (dh2 - 1.0)*h[2]/(a2*dh2*h[2]));
jac[i*nbParameters() + j*2+1] = -/* g[i] */ _ks[i] * (expo/(4.0*x[2]*x[5])) * ((2* a * h[2])/(M_PI*a2*a2*dh2)) * (1 + (dh2 - 1.0)*h[2]/(a2*dh2*h[2]));
}
else
{
......
......@@ -33,8 +33,7 @@ int main(int argc, char** argv)
return 1 ;
}
data* d = NULL ;
d = plugins_manager::get_data(args["data"]) ;
data* d = plugins_manager::get_data(args["data"]) ;
d->load(args["input"]);
// Create output file
......
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