glossy = Blinn_D(H*N, (exponentS ? exponentS->getScalar(stack) : exponent)) * SchlickFresnel(cos_wi_H, dat->mGlossy) / ASDivisor(cos_wi_H, woN, wiN);
col = glossy*(glossyS ? glossyS->getColor(stack) : gloss_color);
inline float Blinn_D(float cos_h, float e)
{
return (e + 1.f) * fPow(cos_h, e);
}
inline float SchlickFresnel(float costheta, float R)
{
float c1 = (1.f - costheta);
float c2 = c1 * c1;
return R + ( (1.f - R) * c1 * c2 * c2 );
}
inline float SchlickFresnel(float costheta, float R)
{
float c1 = (1.f - costheta);
float c2 = c1 * c1;
return R + ( (1.f - R) * c1 * c2 * c2 );
}
vector3d_t pwo = wo;
ray_t pRay;
state.chromatic = was_chromatic;
if(was_chromatic) state.wavelength = RI_S(offs);
//this mat already is initialized, just sample (diffuse...non-specular?)
float s1 = RI_vdC(offs);
float s2 = scrHalton(2, offs);
if(state.rayDivision > 1)
{
s1 = addMod1(s1, state.dc1);
s2 = addMod1(s2, state.dc2);
}
// do proper sampling now...
sample_t s(s1, s2, path_flags);
scol = material->sample(state, sp, pwo, pRay.dir, s, W);
Users browsing this forum: No registered users and 3 guests