Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrecht Van Lommel <brecht@blender.org>2022-01-21 00:31:21 +0300
committerBrecht Van Lommel <brecht@blender.org>2022-01-21 00:32:35 +0300
commit1ac2d2dcb6d1a18e86d86b8d03f46f879a43f33c (patch)
treec478f4ae0ea710efa5c2fffd311ad86ea94d8a9f /intern/cycles/kernel
parent14d261d23afe03ae8b6997fbf8e63a63c1e07eff (diff)
Fix T93711: Cycles diffuse/glossy baking does not write alpha
With the change to use render passes internally the alpha channel got lost. Add support for these render passes to output an alpha channel for baking.
Diffstat (limited to 'intern/cycles/kernel')
-rw-r--r--intern/cycles/kernel/film/read.h15
1 files changed, 15 insertions, 0 deletions
diff --git a/intern/cycles/kernel/film/read.h b/intern/cycles/kernel/film/read.h
index 18a593a75b1..ba895fd8909 100644
--- a/intern/cycles/kernel/film/read.h
+++ b/intern/cycles/kernel/film/read.h
@@ -214,6 +214,21 @@ ccl_device_inline void film_get_pass_pixel_light_path(
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;
+ }
+ }
}
ccl_device_inline void film_get_pass_pixel_float3(ccl_global const KernelFilmConvert *ccl_restrict