commit f8670eb2268b2604d71f04e1ea8a0664b442c28c
parent 74fdffe2c6ad99adca85a8aa923961c5ae261524
Author: Vincent Forest <vincent.forest@meso-star.com>
Date: Wed, 22 Mar 2017 10:21:49 +0100
Fix the path-tracing renderer
The surfaces may be lit by the sun even though it looks backward the
sun.
Diffstat:
1 file changed, 5 insertions(+), 0 deletions(-)
diff --git a/src/ssol_draw_pt.c b/src/ssol_draw_pt.c
@@ -104,7 +104,12 @@ sun_lighting
ASSERT(sun && view && ray_data && bsdf && wo && N && ray_org);
ASSERT(d3_dot(wo, N) >= 0); /* Assume that wo point outward the surface */
+ /* Ensure that the incoming direction point outward the surface */
d3_minus(wi, sun->direction);
+
+ /* The point look backward the sun */
+ if(d3_dot(wi, N) < 0) return 0.0;
+
R = ssf_bsdf_eval(bsdf, wo, N, wi);
if(R <= 0) return 0.0;