void readAlbedo(ivec2 coord, out vec3 albedo) {
    albedo = texelFetch(colortex6, coord, 0).rgb;
}

void readGbuffer1(ivec2 coord, out vec3 normal, out vec3 geoNormal, out float roughness) {
    vec3 ctex7 = texelFetch(colortex7, coord, 0).rgb;
    normal = decodeNormal3x16(ctex7.r);
    geoNormal = decodeNormal3x16(ctex7.g);
    roughness = ctex7.b;
}

void readGbuffer2(ivec2 coord, out vec2 lmcoord, out vec3 specularMap, out int id) {
    vec4 ctex8 = texelFetch(colortex8, coord, 0);
    lmcoord = ctex8.rg;
    vec3 specularRead = decode3x16(ctex8.b);
    specularMap.r = clamp(1 - specularRead.x, 0.089, 1.0);
        specularMap.r = specularMap.r * specularMap.r;
    specularMap.y = clamp(specularRead.y, 0.02, 0.9);
    specularMap.z = specularRead.b;
    id = int(ctex8.a*255.0);
}

void readTranslucentGBuffer(ivec2 coord, out vec3 transNorm, out vec3 transCol, out int transId, out float transSkyLm) {
    vec4 ctex9 = texelFetch(colortex9, coord, 0);
    transNorm = reconstructNormal(ctex9.rg);
    transCol = decode3x16(ctex9.b);
    vec2 decoded = decode2x16(ctex9.a);
    transId = decoded.x*255.0 < 0.4 ? 0 : int(decoded.x*255.0);
    transSkyLm = decoded.y;
}