<commit_before>uniform sampler3D texture0;
uniform sampler3D texture1;
uniform sampler3D texture2;
uniform sampler3D texture3;
uniform sampler3D texture4;

uniform bool u_texActive0;
uniform float u_alpha0;
uniform float u_lowerThreshold0;
uniform float u_upperThreshold0;
uniform int u_colormap0;

uniform bool u_texActive1;
uniform float u_alpha1;
uniform float u_lowerThreshold1;
uniform float u_upperThreshold1;
uniform int u_colormap1;

uniform bool u_texActive2;
uniform float u_alpha2;
uniform float u_lowerThreshold2;
uniform float u_upperThreshold2;
uniform int u_colormap2;

uniform bool u_texActive3;
uniform float u_alpha3;
uniform float u_lowerThreshold3;
uniform float u_upperThreshold3;
uniform int u_colormap3;

uniform bool u_texActive4;
uniform float u_alpha4;
uniform float u_lowerThreshold4;
uniform float u_upperThreshold4;
uniform int u_colormap4;

varying vec3 v_texcoord;

float unpackFloat(const vec4 value) {
    const vec4 bitSh = vec4(1.0 / (256.0 * 256.0 * 256.0), 1.0 / (256.0 * 256.0), 1.0 / 256.0, 1.0);
    //const vec4 bitSh = vec4(0.0, 0.0, 1.0, 1.0 / 256.0 );
    return (dot(value, bitSh));
}

vec4 colormap( vec4 v, int cmap, float lowerThreshold, float upperThreshold, float alpha, vec4 fragColor )
{
    float value = unpackFloat( v );
    vec3 color = vec3(0.0);
    if( value > 0.000001 )
    {
        value = ( value - lowerThreshold ) / ( upperThreshold - lowerThreshold );
        
        if ( cmap == 0 )
        {
            color = vec3( value, value, value );
        }
        if ( cmap == 1 )
        {
            value *= 5.0;
            if( value < 0.0 )
                color = vec3( 0.0, 0.0, 1.0 );
            else if( value < 1.0 )
                color = vec3( 0.0, value, 1.0 );
            else if( value < 2.0 )
                color = vec3( 0.0, 1.0, 2.0-value );
            else if( value < 3.0 )
                color = vec3( value-2.0, 1.0, 0.0 );
            else if( value < 4.0 )
                color = vec3( 1.0, 4.0-value, 0.0 );
            else if( value <= 5.0 )<commit_msg>fix shader for gray values, don't discard voxels > 0 with higher lower threshold<commit_after>uniform sampler3D texture0;
uniform sampler3D texture1;
uniform sampler3D texture2;
uniform sampler3D texture3;
uniform sampler3D texture4;

uniform bool u_texActive0;
uniform float u_alpha0;
uniform float u_lowerThreshold0;
uniform float u_upperThreshold0;
uniform int u_colormap0;

uniform bool u_texActive1;
uniform float u_alpha1;
uniform float u_lowerThreshold1;
uniform float u_upperThreshold1;
uniform int u_colormap1;

uniform bool u_texActive2;
uniform float u_alpha2;
uniform float u_lowerThreshold2;
uniform float u_upperThreshold2;
uniform int u_colormap2;

uniform bool u_texActive3;
uniform float u_alpha3;
uniform float u_lowerThreshold3;
uniform float u_upperThreshold3;
uniform int u_colormap3;

uniform bool u_texActive4;
uniform float u_alpha4;
uniform float u_lowerThreshold4;
uniform float u_upperThreshold4;
uniform int u_colormap4;

varying vec3 v_texcoord;

float unpackFloat(const vec4 value) {
    const vec4 bitSh = vec4(1.0 / (256.0 * 256.0 * 256.0), 1.0 / (256.0 * 256.0), 1.0 / 256.0, 1.0);
    //const vec4 bitSh = vec4(0.0, 0.0, 1.0, 1.0 / 256.0 );
    return (dot(value, bitSh));
}

vec4 colormap( vec4 v, int cmap, float lowerThreshold, float upperThreshold, float alpha, vec4 fragColor )
{
    float value = unpackFloat( v );
    vec3 color = vec3(0.0);
    if( value > 0.000001 )
    {
        value = ( value - lowerThreshold ) / ( upperThreshold - lowerThreshold );
        
        if ( cmap == 0 )
        {
            value = max( value, 0.001 );
            color = vec3( value, value, value );
        }
        if ( cmap == 1 )
        {
            value *= 5.0;
            if( value < 0.0 )
                color = vec3( 0.0, 0.0, 1.0 );
            else if( value < 1.0 )
                color = vec3( 0.0, value, 1.0 );
            else if( value < 2.0 )
                color = vec3( 0.0, 1.0, 2.0-value );
            else if( value < 3.0 )
                color = vec3( value-2.0, 1.0, 0.0 );
            else if( value < 4.0 )
                color = vec3( 1.0, 4.0-value, 0.0 );
            else if( value <= 5.0 )
{'fraction_non_alphanumeric': 0.10170697012802275, 'fraction_numerical': 0.07183499288762446, 'mean_word_length': 2.4724279835390948, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 6, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5681256', 'n_tokens_mistral': 1569, 'n_tokens_neox': 1438, 'n_words': 438}