We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.

Converting hex to rgb for vertex colors. (Got it!)

Home Forums WebGL Troubleshooting Converting hex to rgb for vertex colors. (Got it!)

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #26461
    AvatarXen Wildman
    Licensee

    I realize that there is a way to input hex into the material colors but there doesn’t seem to be a clear way to set vertex color that way. I found a code snippet and added it to the JS then plugged it in to the color picker target:

    The result is not formatted in a way I can use, I need just the digits (228,60,31) or better yet linear (0.894,0.2353,0.1216)

    I then plug that into the math puzzles to /255. Gamma 2.2 is handled in the shader nodes.

    If anyone can help I’d really appreciate input.

    Edit: Or maybe if input type=”color” can output rgb.

    • This topic was modified 3 months, 3 weeks ago by AvatarXen Wildman.
    Attachments:
    You must be logged in to view attached files.
    #26479
    AvatarXen Wildman
    Licensee

    I found a shorter snippet that works perfectly:

    Edit: Need to check more.

    • This reply was modified 3 months, 3 weeks ago by AvatarXen Wildman.
    #26484
    AvatarXen Wildman
    Licensee

    This is the code that ended up working for me:

    #26487
    AvatarXen Wildman
    Licensee
    #26558
    GlifTekGlifTek
    Licensee

    are you supposed to be able to also feed a Hex value into the sphere’s clicked prompt window that asks for RBG?

    #26560
    AvatarXen Wildman
    Licensee

    No, just the color picker in the top left. The RGB on the spheres was before I built the html with color picker.

    #26600
    Yuri KovelenovYuri Kovelenov
    Developer

    glad you worked it out! :good:

    3D Verger, the CEO
    LinkedIn | FB | Twitter | VK | 新浪微博

Viewing 7 posts - 1 through 7 (of 7 total)
  • You must be logged in to reply to this topic.