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.

Xen Wildman

Forum Replies Created

Viewing 14 posts - 31 through 44 (of 44 total)
  • Author
    Posts
  • in reply to: Converting hex to rgb for vertex colors. (Got it!) #26560
    Xen 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.

    in reply to: Converting hex to rgb for vertex colors. (Got it!) #26487
    Xen Wildman
    Customer

    https://tinyurl.com/ybmfd5yq

    Here’s the link.

    in reply to: Converting hex to rgb for vertex colors. (Got it!) #26484
    Xen Wildman
    Customer

    This is the code that ended up working for me:

    function hex2rgb(hex, opacity) {
            var h=hex.replace('#', '');
            h =  h.match(new RegExp('(.{'+h.length/3+'})', 'g'));
    
            for(var i=0; i<h.length; i++)
                h = parseInt(h.length==1? h+h:h, 16);
    
            if (typeof opacity != 'undefined')  h.push(opacity);
    
            return 'rgba('+h.join(',')+')';
    }
    in reply to: Converting hex to rgb for vertex colors. (Got it!) #26479
    Xen Wildman
    Customer

    I found a shorter snippet that works perfectly:

    app.ExternalInterface.hexToRgb = function(hex) {
      return ['0x' + hex[1] + hex[2] | 0, '0x' + hex[3] + hex[4] | 0, '0x' + hex[5] + hex[6] | 0];
    }

    Edit: Need to check more.

    in reply to: CHANGE vertex paint rgb values? #26403
    Xen Wildman
    Customer

    I put in 181 38 124 and it works fine. Yours didn’t work since it is expecting 255 255 255.

    in reply to: CHANGE vertex paint rgb values? #26386
    Xen Wildman
    Customer

    Good catch thank you I missed that. Usually the case for normal maps as well. Yeah I have a list of things I’d like to do including an actual UI.

    It seems like the moment I put a math node into the equation to try to convert to linear, it all goes grey whether in Blender or puzzles.

    in reply to: CHANGE vertex paint rgb values? #26375
    Xen Wildman
    Customer

    It’s not all perfect yet as I have to account for the fact that the environment color and spot light is going to influence the result. I’m totally open to playing with your solution as well and appreciate you sharing. :good:

    in reply to: Convert RGB 255 to RGB 0-1? #26373
    Xen Wildman
    Customer

    Replied there. Big thanks for your input. :good:

    in reply to: CHANGE vertex paint rgb values? #26370
    Xen Wildman
    Customer

    Here’s a link to the current working project:

    https://tinyurl.com/y9mxeeke

    Edit: Click on the sphere’s to set the values, then click the keys to change them.

    in reply to: CHANGE vertex paint rgb values? #26367
    Xen Wildman
    Customer

    Thanks for the reply Gliftek. No offense taken, I’ve been doing computer graphics for many years but you’re right this (WebGL) is new to me. I did solve the RGB thing, I’m not sure how efficient it is but it works.

    I am using vertex color to drive color so that the user can choose to color each element separately. I don’t think that would be very efficient with materials.

    Edit: In Blender that was Gamma 2.2. Changed here to test.

    in reply to: CHANGE vertex paint rgb values? #26296
    Xen Wildman
    Customer

    Thanks so much for the project that I can dissect. Based on your conversation with Gliftek, this is as far as I got but the objects were turning black. I think I understand now.

            app.ExternalInterface.setKeyCol = function(changeObject, changeColor) {
                var myObj = app.scene.getObjectByName(changeObject);
                var setcolor = changeColor;
                var attrName = myObj.material.nodeVCAliases['Keys'];
                if (attrName !== undefined) {
                var vertColor = myObj.geometry.attributes[attrName];
                }
                for (var i = 0; i < vertColor.count; i++) {
                    vertColor.setXYZ(i, 'setColor');
                }
                vertColor.needsUpdate = true;
            }
    in reply to: CHANGE vertex paint rgb values? #26264
    Xen Wildman
    Customer

    What would the whole script look like if you were setting a vertex colour for a picked object in a vertex colour index called KeyCol? Say I want to do another and call it something else?

    Edit: I’d also like user to specify a colour to change to.

    Edit2: Would this puzzle work or is it better to set variable and the external js will pick it up? There are two vertex colors: KeyCol and Legend

    in reply to: RGB Swizzle vertex colour showing black. #26165
    Xen Wildman
    Customer

    Thanks! It works kinda but doesn’t reflect what I’m seeing in Blender or using the same values in separate shaders.

    in reply to: Video as material #25948
    Xen Wildman
    Customer

    The moment I add this to my js file it kills the app and it won’t load anymore. Can someone provide an updated example of a video material?

    Verge3d devs, it would be prudent to have this as an example project included with Verge3d or a puzzle to plug videos in to the application.

Viewing 14 posts - 31 through 44 (of 44 total)