diff options
author | Brecht Van Lommel <brecht@blender.org> | 2020-08-12 17:31:52 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2020-08-12 19:10:50 +0300 |
commit | 6f502136c7fd5d2d115ac28095fb176b72bc1ad6 (patch) | |
tree | a9133c1975c15f99b027898525f8f8aabafce69e /source/blender/draw/engines | |
parent | bff91b32aa75a6d35c668656726298613ac7ed5e (diff) |
Fix T79718: Eevee OpenVDB render error when frames miss part of the grids
Diffstat (limited to 'source/blender/draw/engines')
-rw-r--r-- | source/blender/draw/engines/eevee/eevee_volumes.c | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/source/blender/draw/engines/eevee/eevee_volumes.c b/source/blender/draw/engines/eevee/eevee_volumes.c index 300022e97a9..a443ec61ceb 100644 --- a/source/blender/draw/engines/eevee/eevee_volumes.c +++ b/source/blender/draw/engines/eevee/eevee_volumes.c @@ -66,6 +66,7 @@ static struct { GPUTexture *dummy_density; GPUTexture *dummy_color; GPUTexture *dummy_flame; + GPUTexture *dummy_missing; GPUTexture *dummy_scatter; GPUTexture *dummy_transmit; @@ -154,6 +155,9 @@ static void eevee_create_shader_volumes(void) const float flame = 0.0f; e_data.dummy_flame = DRW_texture_create_3d(1, 1, 1, GPU_R8, DRW_TEX_WRAP, &flame); + + const float missing[4] = {0.0f, 0.0f, 0.0f, 0.0f}; + e_data.dummy_missing = DRW_texture_create_3d(1, 1, 1, GPU_RGBA8, DRW_TEX_WRAP, missing); } void EEVEE_volumes_set_jitter(EEVEE_ViewLayerData *sldata, uint current_sample) @@ -374,7 +378,7 @@ void EEVEE_volumes_cache_init(EEVEE_ViewLayerData *sldata, EEVEE_Data *vedata) /* Fix principle volumetric not working with world materials. */ ListBase gpu_grids = GPU_material_volume_grids(mat); LISTBASE_FOREACH (GPUMaterialVolumeGrid *, gpu_grid, &gpu_grids) { - DRW_shgroup_uniform_texture(grp, gpu_grid->sampler_name, e_data.dummy_density); + DRW_shgroup_uniform_texture(grp, gpu_grid->sampler_name, e_data.dummy_missing); } DRW_shgroup_call_procedural_triangles(grp, NULL, common_data->vol_tex_size[2]); @@ -462,7 +466,7 @@ static bool eevee_volume_object_grids_init(Object *ob, ListBase *gpu_grids, DRWS NULL; DRW_shgroup_uniform_texture( - grp, gpu_grid->sampler_name, (drw_grid) ? drw_grid->texture : e_data.dummy_density); + grp, gpu_grid->sampler_name, (drw_grid) ? drw_grid->texture : e_data.dummy_missing); if (drw_grid && multiple_transforms) { /* Specify per-volume transform matrix that is applied after the @@ -857,6 +861,7 @@ void EEVEE_volumes_free(void) DRW_TEXTURE_FREE_SAFE(e_data.dummy_density); DRW_TEXTURE_FREE_SAFE(e_data.dummy_flame); DRW_TEXTURE_FREE_SAFE(e_data.dummy_color); + DRW_TEXTURE_FREE_SAFE(e_data.dummy_missing); DRW_SHADER_FREE_SAFE(e_data.volumetric_clear_sh); DRW_SHADER_FREE_SAFE(e_data.scatter_sh); |