Fix T65569 Eevee: Volumetrics on alphablend surf. not working in renders
authorClément Foucault <foucault.clem@gmail.com>
Fri, 14 Jun 2019 16:19:45 +0000 (18:19 +0200)
committerClément Foucault <foucault.clem@gmail.com>
Fri, 14 Jun 2019 17:17:06 +0000 (19:17 +0200)
The wrong volume buffer was used one frame out of two.

source/blender/draw/engines/eevee/eevee_volumes.c

index e3afa91..a14e9b0 100644 (file)
@@ -571,10 +571,6 @@ void EEVEE_volumes_draw_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
                                   {GPU_ATTACHMENT_NONE,
                                    GPU_ATTACHMENT_TEXTURE(txl->volume_scatter_history),
                                    GPU_ATTACHMENT_TEXTURE(txl->volume_transmit_history)});
-
-    /* Usage happens after buffer have been swapped. */
-    effects->volume_scatter = txl->volume_scatter_history;
-    effects->volume_transmit = txl->volume_transmit_history;
   }
   else {
     DRW_TEXTURE_FREE_SAFE(txl->volume_prop_scattering);
@@ -588,10 +584,10 @@ void EEVEE_volumes_draw_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata)
     GPU_FRAMEBUFFER_FREE_SAFE(fbl->volumetric_fb);
     GPU_FRAMEBUFFER_FREE_SAFE(fbl->volumetric_scat_fb);
     GPU_FRAMEBUFFER_FREE_SAFE(fbl->volumetric_integ_fb);
-
-    effects->volume_scatter = e_data.dummy_scatter;
-    effects->volume_transmit = e_data.dummy_transmit;
   }
+
+  effects->volume_scatter = e_data.dummy_scatter;
+  effects->volume_transmit = e_data.dummy_transmit;
 }
 
 void EEVEE_volumes_compute(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *vedata)
@@ -618,6 +614,9 @@ void EEVEE_volumes_compute(EEVEE_ViewLayerData *UNUSED(sldata), EEVEE_Data *veda
     SWAP(GPUTexture *, txl->volume_scatter, txl->volume_scatter_history);
     SWAP(GPUTexture *, txl->volume_transmit, txl->volume_transmit_history);
 
+    effects->volume_scatter = txl->volume_scatter;
+    effects->volume_transmit = txl->volume_transmit;
+
     /* Restore */
     GPU_framebuffer_bind(fbl->main_fb);