Fix Cycles AO pass not working for shadow catcher objects.
authorBrecht Van Lommel <brechtvanlommel@gmail.com>
Mon, 20 Aug 2018 14:09:17 +0000 (16:09 +0200)
committerBrecht Van Lommel <brechtvanlommel@gmail.com>
Mon, 20 Aug 2018 14:09:17 +0000 (16:09 +0200)
intern/cycles/kernel/kernel_accumulate.h

index 6b3cec9fda6ae88c37b8b38d6f6f11b0f2c2d10e..86ad6e1a0615e14b0ee94b2696cd9738a2738de6 100644 (file)
@@ -320,7 +320,13 @@ ccl_device_inline void path_radiance_accum_ao(PathRadiance *L,
                                               float3 bsdf,
                                               float3 ao)
 {
+       /* Store AO pass. */
+       if(L->use_light_pass && state->bounce == 0) {
+               L->ao += alpha*throughput*ao;
+       }
+
 #ifdef __SHADOW_TRICKS__
+       /* For shadow catcher, accumulate ratio. */
        if(state->flag & PATH_RAY_STORE_SHADOW_INFO) {
                float3 light = throughput * bsdf;
                L->path_total += light;
@@ -335,12 +341,11 @@ ccl_device_inline void path_radiance_accum_ao(PathRadiance *L,
 #ifdef __PASSES__
        if(L->use_light_pass) {
                if(state->bounce == 0) {
-                       /* directly visible lighting */
+                       /* Directly visible lighting. */
                        L->direct_diffuse += throughput*bsdf*ao;
-                       L->ao += alpha*throughput*ao;
                }
                else {
-                       /* indirectly visible lighting after BSDF bounce */
+                       /* Indirectly visible lighting after BSDF bounce. */
                        L->indirect += throughput*bsdf*ao;
                }
        }