From 2633928e1def66c63e89a4534fdcc0d9c268c7c4 Mon Sep 17 00:00:00 2001 From: Sergey Sharybin Date: Wed, 26 Aug 2015 17:51:54 +0200 Subject: [PATCH] Fix T45232: Cycles bake artifacts with transparent textures The issue was caused by uninitialized ray used for composite and AO evaluation. Can;t really think of "proper" ray configuration here, it's all a bit arbitrary but think initializing the ray in a way so we look at the surface in a negative normal direction is much better alternative to uninitialized ray. Open for alternative suggestions tho. --- intern/cycles/kernel/kernel_bake.h | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/intern/cycles/kernel/kernel_bake.h b/intern/cycles/kernel/kernel_bake.h index 2fca83c615f..2b305e5488d 100644 --- a/intern/cycles/kernel/kernel_bake.h +++ b/intern/cycles/kernel/kernel_bake.h @@ -31,6 +31,13 @@ ccl_device void compute_light_pass(KernelGlobals *kg, ShaderData *sd, PathRadian float3 throughput = make_float3(1.0f, 1.0f, 1.0f); bool is_sss_sample = is_sss; + ray.P = sd->P + sd->Ng; + ray.D = -sd->Ng; + ray.t = FLT_MAX; +#ifdef __CAMERA_MOTION__ + ray.time = TIME_INVALID; +#endif + /* init radiance */ path_radiance_init(&L_sample, kernel_data.film.use_light_pass);