diff options
author | Brecht Van Lommel <brecht@blender.org> | 2022-08-31 21:09:12 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2022-08-31 21:51:50 +0300 |
commit | 3a605b23d02263be6bca9046e20b46a60832d971 (patch) | |
tree | da54e85795fa142b43ed692b26d30e9322f1f927 /intern/cycles/kernel | |
parent | b9998541e193b1f30728fc034c7a10daae183a08 (diff) |
Fix T100708: Cycles bake of diffuse/glossy color not outputting alpha
Diffstat (limited to 'intern/cycles/kernel')
-rw-r--r-- | intern/cycles/kernel/film/read.h | 15 | ||||
-rw-r--r-- | intern/cycles/kernel/integrator/init_from_bake.h | 2 |
2 files changed, 16 insertions, 1 deletions
diff --git a/intern/cycles/kernel/film/read.h b/intern/cycles/kernel/film/read.h index a0236909f4b..995c20a0053 100644 --- a/intern/cycles/kernel/film/read.h +++ b/intern/cycles/kernel/film/read.h @@ -235,6 +235,21 @@ ccl_device_inline void film_get_pass_pixel_float3(ccl_global const KernelFilmCon pixel[0] = f.x; pixel[1] = f.y; pixel[2] = f.z; + + /* Optional alpha channel. */ + if (kfilm_convert->num_components >= 4) { + if (kfilm_convert->pass_combined != PASS_UNUSED) { + float scale, scale_exposure; + film_get_scale_and_scale_exposure(kfilm_convert, buffer, &scale, &scale_exposure); + + ccl_global const float *in_combined = buffer + kfilm_convert->pass_combined; + const float alpha = in_combined[3] * scale; + pixel[3] = film_transparency_to_alpha(alpha); + } + else { + pixel[3] = 1.0f; + } + } } /* -------------------------------------------------------------------- diff --git a/intern/cycles/kernel/integrator/init_from_bake.h b/intern/cycles/kernel/integrator/init_from_bake.h index dd26215bcd2..c77fc2540c1 100644 --- a/intern/cycles/kernel/integrator/init_from_bake.h +++ b/intern/cycles/kernel/integrator/init_from_bake.h @@ -113,7 +113,7 @@ ccl_device bool integrator_init_from_bake(KernelGlobals kg, if (prim == -1) { /* Accumulate transparency for empty pixels. */ kernel_accum_transparent(kg, state, 0, 1.0f, buffer); - return false; + return true; } prim += kernel_data.bake.tri_offset; |