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 & WebXR Troubleshooting Converting hex to rgb for vertex colors. (Got it!)

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

    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 11 months, 3 weeks ago by AvatarXen Wildman.
    • This topic was modified 11 months, 3 weeks ago by AvatarXen Wildman.
    Attachments:
    You must be logged in to view attached files.
    #26479
    AvatarXen Wildman
    Customer

    I found a shorter snippet that works perfectly:

    Edit: Need to check more.

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

    This is the code that ended up working for me:

    #26487
    AvatarXen Wildman
    Customer

    https://tinyurl.com/ybmfd5yq

    Here’s the link.

    #26558
    GlifTekGlifTek
    Customer

    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
    Customer

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

    #26600

    glad you worked it out! :good:

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

    #39756
    Avatarindrazulfi
    Participant

    https://tinyurl.com/ybmfd5yq

    Here’s the link.

    Hi @Xen, Would you mind to explain little bit more on this ? :)
    Thanks!

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