Commit f3540408 authored by Laurent Belcour's avatar Laurent Belcour
Browse files

Adding the possiblity to put a Fresnel term in the BRDF

parent bbe04e9b
......@@ -24,7 +24,14 @@ vec retroblinn_function::value(const vec& x) const
vec res(dimY());
for(int i=0; i<dimY(); ++i)
{
res[i] = _ks[i] * std::pow(x[0], _N[i]);
if(x[0] >= 0.0)
{
res[i] = _ks[i] * std::pow(x[0], _N[i]);
}
else
{
res[i] = 0.0;
}
}
return res;
......@@ -100,10 +107,14 @@ vec retroblinn_function::parametersJacobian(const vec& x) const
jac[i*nbParameters() + j*2+0] = std::pow(x[0], _N[j]);
// df / dN
if(x[0] == 0.0)
if(x[0] <= 0.0)
{
jac[i*nbParameters() + j*2+1] = 0.0;
}
else
{
jac[i*nbParameters() + j*2+1] = _ks[j] * std::log(x[0]) * std::pow(x[0], _N[j]);
}
}
else
{
......
......@@ -61,6 +61,11 @@ def parseFunction(xmlNode):
cmd += ' --' + param.attrib['name'] + ' ' + param.attrib['value'];
#end
fresnel = xmlNode.find('fresnel');
if not (fresnel is None):
cmd += ' --fresnel ' + lib_dir + '/' + libName(fresnel.attrib['name']);
#end
return cmd;
#end
......
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