diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2018-09-10 19:29:14 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2018-09-11 17:15:43 +0300 |
commit | 766d9c293773a5e72e7ba466d4521f52711854cb (patch) | |
tree | e368340325397d0cf459979b736424965ad258bf /source | |
parent | 9ac72ab69d1f91a7200e5eb43f5a6ad9f8547c9a (diff) |
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.
Diffstat (limited to 'source')
-rw-r--r-- | source/blender/gpu/shaders/gpu_shader_material.glsl | 3 |
1 files changed, 2 insertions, 1 deletions
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; } |