Slide 22
Slide 22 text
実装例
float depthHeuristics(float depth, float previous_depth, float sigma)
{
const float diff =
(depth - previous_depth) * (depth - previous_depth) / depth;
return clamp(exp(-sigma * diff), 0.0, 1.0);
}
float normalHeuristics(vec3 normal, vec3 previous_normal, float sigma)
{
return clamp(pow(max(dot(normal, previous_normal), 0.0), sigma), 0.0, 1.0);
}
float rejectionHeuristics(vec3 p0, vec3 n0, vec3 p1, vec3 n1)
{
float weight = 1.0;
weight *= depthHeuristics(distance(g_Eye, p0), distance(g_Eye, p1),
g_DepthRejectionHeuristicsSigma);
weight *= normalHeuristics(n0, n1, g_NormalRejectionHeuristicsSigma);
return weight;
}