[Bf-blender-cvs] [9feb0d5f2eb] master: Fix T74220 Mantaflow Color Mapping not ignoring alpha value

Clément Foucault noreply at git.blender.org
Mon Jun 29 14:19:59 CEST 2020


Commit: 9feb0d5f2eb87cc5f19b00c8928514e44edc4dde
Author: Clément Foucault
Date:   Mon Jun 29 14:19:44 2020 +0200
Branches: master
https://developer.blender.org/rB9feb0d5f2eb87cc5f19b00c8928514e44edc4dde

Fix T74220 Mantaflow Color Mapping not ignoring alpha value

And also remove some sRGB hack.

===================================================================

M	source/blender/draw/engines/workbench/shaders/workbench_volume_frag.glsl
M	source/blender/gpu/intern/gpu_draw_smoke.c

===================================================================

diff --git a/source/blender/draw/engines/workbench/shaders/workbench_volume_frag.glsl b/source/blender/draw/engines/workbench/shaders/workbench_volume_frag.glsl
index 0c2b7850f94..2920a504062 100644
--- a/source/blender/draw/engines/workbench/shaders/workbench_volume_frag.glsl
+++ b/source/blender/draw/engines/workbench/shaders/workbench_volume_frag.glsl
@@ -107,7 +107,6 @@ void volume_properties(vec3 ls_pos, out vec3 scattering, out float extinction)
 #ifdef USE_COBA
   float val = sample_volume_texture(densityTexture, co).r;
   vec4 tval = texture(transferTexture, val) * densityScale;
-  tval.rgb = pow(tval.rgb, vec3(2.2));
   scattering = tval.rgb * 1500.0;
   extinction = max(1e-4, tval.a * 50.0);
 #else
@@ -127,7 +126,7 @@ void volume_properties(vec3 ls_pos, out vec3 scattering, out float extinction)
 
 #  ifdef VOLUME_SMOKE
   /* 800 is arbitrary and here to mimic old viewport. TODO make it a parameter */
-  scattering += pow(emission.rgb, vec3(2.2)) * emission.a * 800.0;
+  scattering += emission.rgb * emission.a * 800.0;
 #  endif
 #endif
 }
diff --git a/source/blender/gpu/intern/gpu_draw_smoke.c b/source/blender/gpu/intern/gpu_draw_smoke.c
index 80c59ed47c9..67947df0ff7 100644
--- a/source/blender/gpu/intern/gpu_draw_smoke.c
+++ b/source/blender/gpu/intern/gpu_draw_smoke.c
@@ -99,6 +99,7 @@ static void create_color_ramp(const struct ColorBand *coba, float *data)
 {
   for (int i = 0; i < TFUNC_WIDTH; i++) {
     BKE_colorband_evaluate(coba, (float)i / TFUNC_WIDTH, &data[i * 4]);
+    straight_to_premul_v4(&data[i * 4]);
   }
 }
 
@@ -115,7 +116,7 @@ static GPUTexture *create_transfer_function(int type, const struct ColorBand *co
       break;
   }
 
-  GPUTexture *tex = GPU_texture_create_1d(TFUNC_WIDTH, GPU_RGBA8, data, NULL);
+  GPUTexture *tex = GPU_texture_create_1d(TFUNC_WIDTH, GPU_SRGB8_A8, data, NULL);
 
   MEM_freeN(data);



More information about the Bf-blender-cvs mailing list