diff --git a/scene/5.2.scn b/scene/5.2.scn index 597fc09..13898cb 100644 --- a/scene/5.2.scn +++ b/scene/5.2.scn @@ -72,7 +72,7 @@ material = { } light = { - type = lambert + type = emissive properties = { samplers = { emissive = { diff --git a/scene/5.3.scn b/scene/5.3.scn index 745816e..98b1910 100644 --- a/scene/5.3.scn +++ b/scene/5.3.scn @@ -27,8 +27,10 @@ version = 0.2 environment = { type = gradient config = { - a = col3(0.5,0.5,0.5) - b = col3(0.4,0.4,0.4) + # a = col3(0.3,0.5,0.9) + # b = col3(1.0,1.0,1.0) + a = col3(0,0,0); + b = col3(0,0,0); } } @@ -94,6 +96,10 @@ material = { type = color value = col3(1,1,1) } + diffuse = { + type = color + value = col3(0,0,0) + } } } } @@ -123,10 +129,10 @@ material = { } light = { - type = emissive + type = emissive properties = { samplers = { - emissive = { + emissive = { type = color value = col3(1,1,1) } @@ -139,7 +145,7 @@ material = { properties = { scalars = { exponent = 256 - reflectance = 1 + reflectance = .5 } samplers = { diff --git a/scene/5.5.scn b/scene/5.5.scn index 4fe0430..ace18f1 100644 --- a/scene/5.5.scn +++ b/scene/5.5.scn @@ -32,7 +32,7 @@ version = 0.1 environment = { type = color config = { - value = col3(1,1,1) + value = col3(0,0,0) } } diff --git a/src/xtcore/integrator/pathtracer/integrator.cc b/src/xtcore/integrator/pathtracer/integrator.cc index 485118c..e250f40 100644 --- a/src/xtcore/integrator/pathtracer/integrator.cc +++ b/src/xtcore/integrator/pathtracer/integrator.cc @@ -26,15 +26,21 @@ nimg::ColorRGBf Integrator::eval(size_t depth, hit_result_t &in) bool hit = ctx->scene.intersection(in.ray, hit_record); hit_record.ior = in.ior; + if (hit) { + nimg::ColorRGBf value; + const xtcore::asset::IMaterial *m = ctx->scene.get_material(hit_record.id_object); xtcore::hit_result_t hit_result; bool path_continues = m->sample_path(hit_result, hit_record); + + value = in.intensity * hit_result.intensity; + if (path_continues) { - in.intensity = hit_result.intensity * eval(--depth, hit_result); + value *= eval(--depth, hit_result); } - return in.intensity; + return value; } return ctx->scene.sample_environment(in.ray.direction);