[Bf-blender-cvs] [766d9c29377] blender2.8: GPUMaterial: Fix issue with coloramp and constant interpolation

Clément Foucault noreply at git.blender.org
Tue Sep 11 16:15:45 CEST 2018


Commit: 766d9c293773a5e72e7ba466d4521f52711854cb
Author: Clément Foucault
Date:   Mon Sep 10 18:29:14 2018 +0200
Branches: blender2.8
https://developer.blender.org/rB766d9c293773a5e72e7ba466d4521f52711854cb

GPUMaterial: Fix issue with coloramp and constant interpolation

It was not respecting the clamp to edge texture param because we use
texelFetch directly in this case.

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

M	source/blender/gpu/shaders/gpu_shader_material.glsl

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

diff --git a/source/blender/gpu/shaders/gpu_shader_material.glsl b/source/blender/gpu/shaders/gpu_shader_material.glsl
index 5ea888ca774..84e4165ac00 100644
--- a/source/blender/gpu/shaders/gpu_shader_material.glsl
+++ b/source/blender/gpu/shaders/gpu_shader_material.glsl
@@ -820,7 +820,8 @@ void valtorgb(float fac, sampler1DArray colormap, float layer, out vec4 outcol,
 
 void valtorgb_nearest(float fac, sampler1DArray colormap, float layer, out vec4 outcol, out float outalpha)
 {
-	outcol = texelFetch(colormap, ivec2(fac * textureSize(colormap, 0).x, layer), 0);
+	fac = clamp(fac, 0.0, 1.0);
+	outcol = texelFetch(colormap, ivec2(fac * (textureSize(colormap, 0).x - 1), layer), 0);
 	outalpha = outcol.a;
 }



More information about the Bf-blender-cvs mailing list