• insomniac_lemon@lemmy.cafe
    link
    fedilink
    English
    arrow-up
    1
    ·
    edit-2
    2 hours ago

    Somewhat similar thing, this is what I came up with to quantize to 12-bit-RGB (shorthand hexadecimal, e.g. #AC3 --> #AACC33) in a Godot shader:

    COLOR = vec4((round(color.r * 15.0) / 15.0), (round(color.g * 15.0) / 15.0), (round(color.b * 15.0) / 15.0), color.a);

    Maybe there’s a better way (I’m wasn’t sure how to see actual numbers, other than knowing it’s linear color space) but it works. For example it takes #135531 in a bit of AA (between label outlines) and turns it to #115533.