Commit 5c033cd7 authored by Sebastian Eichelbaum's avatar Sebastian Eichelbaum
Browse files

[CHANGE] pos-neg colormap now should respect positive and negative-only data

parent 204aa23e
......@@ -154,11 +154,12 @@ vec4 negative2positive( in float valueDescaled, in float minV, in float scaleV )
*/
const vec3 zeroColor = vec3( 1.0, 1.0, 1.0 );
const vec3 negColor = vec3( 0.0, 1.0, 1.0 );
const vec3 posColor = vec3( 1.0, 1.0, 0.0 );
const vec3 negColor = vec3( 1.0, 1.0, 0.0 );
const vec3 posColor = vec3( 0.0, 1.0, 1.0 );
float negShare = abs( valueDescaled / minV ) * ( 1.0 - step( 0.0, valueDescaled ) );
float posShare = abs( valueDescaled / ( minV + scaleV ) ) * step( 0.0, valueDescaled );
float isNegative = 1.0 - ( -1.0 * clamp( sign( minV ), -1.0, 0.0 ) ); // this is 1.0 if minV is smaller than zero
float negShare = isNegative * abs( valueDescaled / minV ) * ( 1.0 - step( 0.0, valueDescaled ) );
float posShare = ( 1.0 - isNegative ) * abs( valueDescaled / ( minV + scaleV ) ) * step( 0.0, valueDescaled );
vec3 r1 = zeroColor - ( negColor * negShare ) - ( posColor * posShare );
return vec4( r1, 1.0 );
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment