diff options
author | Brecht Van Lommel <brecht> | 2020-03-11 15:56:28 +0300 |
---|---|---|
committer | Brecht Van Lommel <brecht@blender.org> | 2020-03-11 16:42:46 +0300 |
commit | c8acb6dd6c58c6a85ab18d26f02973437cb2f700 (patch) | |
tree | c45a1b47d8692b7b633507d97f325fa5c2f5a3c8 /source/blender/draw/engines/workbench/workbench_volume.c | |
parent | f3a33a92987fd648f194898c3789f573fdadca6f (diff) |
Smoke: put density/color in separate textures, fixes for workbench shader
This is more in line with standard grids and means we don't have to make
many special exceptions in the upcoming change for arbitrary number of volume
grids support in Eevee.
The workbench shader was also changed to fix bugs where squared density was
used, and the smoke color would affect the density so that black smoke would
be invisible. This can change the look of smoke in workbench significantly.
When using the color grid when smoke has a constant color, the color grid
will no longer be premultiplied by the density. If the color is constant
we want to be able not to store a grid at all. This breaks one test for
Cycles and Eevee, but the setup in that test using a color without density
does not make sense. It suffers from artifacts since the unpremultiplied
color grid by itself will not have smooth boundaries.
Differential Revision: https://developer.blender.org/D6951
Diffstat (limited to 'source/blender/draw/engines/workbench/workbench_volume.c')
-rw-r--r-- | source/blender/draw/engines/workbench/workbench_volume.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/source/blender/draw/engines/workbench/workbench_volume.c b/source/blender/draw/engines/workbench/workbench_volume.c index 2f7296fb40f..2c61e894e8c 100644 --- a/source/blender/draw/engines/workbench/workbench_volume.c +++ b/source/blender/draw/engines/workbench/workbench_volume.c @@ -146,7 +146,8 @@ void workbench_volume_cache_populate(WORKBENCH_Data *vedata, GPU_create_smoke(mmd, 1); } - if ((!mds->use_coba && mds->tex == NULL) || (mds->use_coba && mds->tex_field == NULL)) { + if ((!mds->use_coba && (mds->tex_density == NULL && mds->tex_color == NULL)) || + (mds->use_coba && mds->tex_field == NULL)) { return; } @@ -201,7 +202,8 @@ void workbench_volume_cache_populate(WORKBENCH_Data *vedata, static float white[3] = {1.0f, 1.0f, 1.0f}; bool use_constant_color = ((mds->active_fields & FLUID_DOMAIN_ACTIVE_COLORS) == 0 && (mds->active_fields & FLUID_DOMAIN_ACTIVE_COLOR_SET) != 0); - DRW_shgroup_uniform_texture(grp, "densityTexture", mds->tex); + DRW_shgroup_uniform_texture( + grp, "densityTexture", (mds->tex_color) ? mds->tex_color : mds->tex_density); DRW_shgroup_uniform_texture(grp, "shadowTexture", mds->tex_shadow); DRW_shgroup_uniform_texture( grp, "flameTexture", (mds->tex_flame) ? mds->tex_flame : e_data.dummy_tex); |