Fix T80787: Fix White edges when rendering transparent smoke

The UV/Image editor was doing interpolation including over the alpha
value what makes will render incorrectly when interpolating between pure
emissive colors and pre multiplied colors. This change disabled the
interpolation.
This commit is contained in:
Jeroen Bakker 2020-09-15 15:40:04 +02:00
parent 93b8040f57
commit dedd9ce0aa
Notes: blender-bot 2023-02-14 11:24:03 +01:00
Referenced by issue #80787, 2.91 Image Editor Quick Smoke (Fire) Pure Emission is displayed as (1.0, 1.0, 1.0) even when the actual values are 5 orders of magnitude lower.
1 changed files with 2 additions and 8 deletions

View File

@ -141,15 +141,9 @@ static void image_cache_image(IMAGE_Data *vedata, Image *image, ImageUser *iuser
const bool use_premul_alpha = image->alpha_mode == IMA_ALPHA_PREMUL;
const bool is_tiled_texture = tex_tile_data != NULL;
const bool do_repeat = (!is_tiled_texture) && ((sima->flag & SI_DRAW_TILE) != 0);
const bool is_zoom_out = sima->zoom < 1.0f;
/* use interpolation filtering when zooming out */
eGPUSamplerState state = 0;
SET_FLAG_FROM_TEST(state, is_zoom_out, GPU_SAMPLER_FILTER);
int draw_flags = 0;
SET_FLAG_FROM_TEST(draw_flags, do_repeat, SIMA_DRAW_FLAG_DO_REPEAT);
if ((sima->flag & SI_USE_ALPHA) != 0) {
/* Show RGBA */
draw_flags |= SIMA_DRAW_FLAG_SHOW_ALPHA | SIMA_DRAW_FLAG_APPLY_ALPHA;
@ -181,11 +175,11 @@ static void image_cache_image(IMAGE_Data *vedata, Image *image, ImageUser *iuser
GPUShader *shader = IMAGE_shader_image_get(is_tiled_texture);
DRWShadingGroup *shgrp = DRW_shgroup_create(shader, psl->image_pass);
if (is_tiled_texture) {
DRW_shgroup_uniform_texture_ex(shgrp, "imageTileArray", pd->texture, state);
DRW_shgroup_uniform_texture_ex(shgrp, "imageTileArray", pd->texture, 0);
DRW_shgroup_uniform_texture(shgrp, "imageTileData", tex_tile_data);
}
else {
DRW_shgroup_uniform_texture_ex(shgrp, "imageTexture", pd->texture, state);
DRW_shgroup_uniform_texture_ex(shgrp, "imageTexture", pd->texture, 0);
}
DRW_shgroup_uniform_vec2_copy(shgrp, "farNearDistances", far_near);
DRW_shgroup_uniform_vec4_copy(shgrp, "color", color);