i have a glslf file how do i convert that to rgb (primitive lua knowledge)

14 views Asked by At

i have a file for some grass that is flat and i have very basic lua knowledge i want the rgb to make some camo for the game so far i tried a picture of it with a rgb colour finder that got me: r:95 g:102 b:64 here is the code (not mine):

#include "depth_utils.glslh"
in float log_z;
in vec3 vertex_color_out;
in vec3 vertex_normal_out;
in vec3 vertex_world_position_out;
in vec4 vertex_position_prev_out;
in vec4 vertex_position_next_out;

out vec4 gnormal_light_factor_out;
out vec4 gcolor_out;
#if VELOCITY_ENABLED == 1
out vec2 gvelocity_out;
#endif

uniform float light_factor;

uniform int is_motion_blur_affected;

#if CLIP_PLANE == 1
uniform vec4 clip_plane;
#endif

#if DITHER == 1
uniform float dither_opacity;
mat4 thresholdMatrix = mat4
(
1.0 / 17.0,  9.0 / 17.0,  3.0 / 17.0, 11.0 / 17.0,
13.0 / 17.0,  5.0 / 17.0, 15.0 / 17.0,  7.0 / 17.0,
4.0 / 17.0, 12.0 / 17.0,  2.0 / 17.0, 10.0 / 17.0,
16.0 / 17.0,  8.0 / 17.0, 14.0 / 17.0,  6.0 / 17.0
);
#endif



void main()
{
    gl_FragDepth = log_z_to_frag_depth(log_z);

#if CLIP_PLANE == 1
    if(dot(vertex_world_position_out, clip_plane.xyz) < clip_plane.w)
    {
        discard;
    }
#endif

#if DITHER == 1
    int pix_x = int(gl_FragCoord.x);
    int pix_y = int(gl_FragCoord.y);
    float dither_threshold = thresholdMatrix[pix_x % 4][pix_y % 4];
    if(dither_threshold > dither_opacity)
    {
        discard;
    }
#endif

#if VELOCITY_ENABLED == 1
    // Velocity
    vec2 screen_pos_next = (vertex_position_next_out.xy / vertex_position_next_out.w) * 0.5 + 0.5;
    vec2 screen_pos_prev = (vertex_position_prev_out.xy / vertex_position_prev_out.w) * 0.5 + 0.5;
    gvelocity_out = (screen_pos_next - screen_pos_prev);
#endif

    gnormal_light_factor_out = vec4(normalize(vertex_normal_out), light_factor);

    gcolor_out = vec4(vertex_color_out, 1);

    
if(vertex_color_out.x >= 0.2 && vertex_color_out.x <= 0.22 && vertex_color_out.y >= 0.23 && vertex_color_out.y <= 0.26 && vertex_color_out.z >= 0.01 && vertex_color_out.z <= 0.03)
        {
        gcolor_out = vec4(vec3(0.31, 0.32, 0.20), 1);
        }
else if(vertex_color_out.x >= 0.50 && vertex_color_out.x <= 0.57 && vertex_color_out.y >= 0.43 && vertex_color_out.y <= 0.49 && vertex_color_out.z >= 0.18 && vertex_color_out.z <= 0.26)
        {
        gcolor_out = vec4(vec3(0.54, 0.47, 0.39), 1);
        }
else if(vertex_color_out.x >= 0.34 && vertex_color_out.x <= 0.36 && vertex_color_out.y >= 0.24 && vertex_color_out.y <= 0.26 && vertex_color_out.z >= 0.16 && vertex_color_out.z <= 0.18)
        {
      gcolor_out = vec4(vec3(0.34, 0.24, 0.19), 1);
        }
else if(vertex_color_out.x >= 0.74 && vertex_color_out.x <= 0.76 && vertex_color_out.y >= 0.56 && vertex_color_out.y <= 0.58 && vertex_color_out.z >= 0.37 && vertex_color_out.z <= 0.39)
        {
      gcolor_out = vec4(vec3(0.74, 0.57, 0.38), 1);
        }
else if(vertex_color_out.x >= 0.5 && vertex_color_out.x <= 0.51 && vertex_color_out.y >= 0.38 && vertex_color_out.y <= 0.39 && vertex_color_out.z >= 0.25 && vertex_color_out.z <= 0.26)
        {
      gcolor_out = vec4(vec3(0.50, 0.38, 0.26), 1);
        }
else if(vertex_color_out.x >= 0.73 && vertex_color_out.x <= 0.74 && vertex_color_out.y >= 0.61 && vertex_color_out.y <= 0.62 && vertex_color_out.z >= 0.49 && vertex_color_out.z <= 0.5)
        {
      gcolor_out = vec4(vec3(0.74, 0.62, 0.49), 1);
    // THIS COLOR IS UGLY, PLEASE FIND A BETTER ONE
        }
    else
        {
        gcolor_out = vec4(vertex_color_out, 1);
        }
    // This huge part of code exchanges large amount of trolling

    // Convert from srgb to linear space
    gcolor_out.r = pow(gcolor_out.r, 2.2);
    gcolor_out.g = pow(gcolor_out.g, 2.2);
    gcolor_out.b = pow(gcolor_out.b, 2.2);
    // Pro linus tip: raleway is the best font!
}

post qualification gibberish: agdshjfnwsjhfkakffuiwaujnuvhuajinifhiojaihjsniujcnuhnuhajdhoomsaojhniofhnawijhoiuhfsoahjohnowahjjouifhjoiahwioasfhoiawhjfoawjhofihaw8faow8isudjoaw8uf8waofhjaosjfif8awu hrdsf sdfsegfgsegsd sefesghds seafwasfgfhrhgjyhjyhgnfthtfhtftf

0

There are 0 answers